Skip to content

Commit

Permalink
use cluster health endpoint instead of the health report endpoint for…
Browse files Browse the repository at this point in the history
… scp e2e test (#7455) (#7463)

* avoid using health report endpoint for scp tests.

(cherry picked from commit 022881c)
  • Loading branch information
kvalliyurnatt committed Jan 12, 2024
1 parent a21d2de commit 64eb953
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions test/e2e/es/stackconfigpolicy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,18 +183,17 @@ func TestStackConfigPolicy(t *testing.T) {
}),
},
test.Step{
Name: "Cluster Name should be as set in config",
Name: "Cluster name should be as set in the config",
Test: test.Eventually(func() error {
esClient, err := elasticsearch.NewElasticsearchClient(es.Elasticsearch, k)
assert.NoError(t, err)

var clusterName ClusterName
_, err = request(esClient, http.MethodGet, "/_health_report", nil, &clusterName)
if err != nil {
var apiResponse ClusterInfoResponse
if _, err = request(esClient, http.MethodGet, "/", nil, &apiResponse); err != nil {
return err
}

require.Equal(t, clusterNameFromConfig, clusterName.ClusterNameFromAPI)
require.Equal(t, clusterNameFromConfig, apiResponse.ClusterName)
return nil
}),
},
Expand Down Expand Up @@ -314,8 +313,8 @@ type ClusterSettings struct {
} `json:"persistent"`
}

type ClusterName struct {
ClusterNameFromAPI string `json:"cluster_name"`
type ClusterInfoResponse struct {
ClusterName string `json:"cluster_name"`
}

type SnapshotRepositories map[string]SnapshotRepository
Expand Down

0 comments on commit 64eb953

Please sign in to comment.