Skip to content

Commit

Permalink
Fix: skip if below test cases.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock committed Aug 20, 2024
1 parent ea08582 commit e0b86f4
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion internal/test/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func SkipIfBelowVersion(t *testing.T, client *opensearchapi.Client, majorVersion
t.Helper()
major, patch, _, err := GetVersion(client)
assert.Nil(t, err)
if major <= majorVersion && patch <= patchVersion {
if major < majorVersion || (major == majorVersion && patch < patchVersion) {
t.Skipf("Skiping %s as version %d.%d.x does not support this endpoint", testName, major, patch)
}
}
Expand Down
4 changes: 2 additions & 2 deletions opensearchapi/api_cat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ func TestCatClient(t *testing.T) {
for catType, value := range testCases {
t.Run(catType, func(t *testing.T) {
if catType == "ClusterManager" {
ostest.SkipIfBelowVersion(t, client, 1, 3, catType)
ostest.SkipIfBelowVersion(t, client, 2, 0, catType)
}
for _, testCase := range value {
t.Run(testCase.Name, func(t *testing.T) {
Expand Down Expand Up @@ -399,7 +399,7 @@ func TestCatClient(t *testing.T) {
ostest.CompareRawJSONwithParsedJSON(t, resp.Allocations, resp.Inspect().Response)
})
t.Run("ClusterManager", func(t *testing.T) {
ostest.SkipIfBelowVersion(t, client, 1, 3, "ClusterManager")
ostest.SkipIfBelowVersion(t, client, 2, 0, "ClusterManager")
resp, err := client.Cat.ClusterManager(nil, nil)
assert.Nil(t, err)
assert.NotNil(t, resp)
Expand Down
2 changes: 1 addition & 1 deletion plugins/ism/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ func TestClient(t *testing.T) {
ostest.CompareRawJSONwithParsedJSON(t, &resp, resp.Inspect().Response)
})
t.Run("Explain with show_policy", func(t *testing.T) {
ostest.SkipIfBelowVersion(t, osClient, 1, 2, "Explain with validate_action")
ostest.SkipIfBelowVersion(t, osClient, 1, 3, "Explain with validate_action")
resp, err := client.Explain(nil, &ism.ExplainReq{Indices: testIndex, Params: ism.ExplainParams{ShowPolicy: true}})
assert.Nil(t, err)
assert.NotNil(t, resp)
Expand Down
2 changes: 1 addition & 1 deletion plugins/security/api_ssl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func TestSSLClient(t *testing.T) {
osAPIclient, err := ostest.NewClient()
require.Nil(t, err)

ostest.SkipIfBelowVersion(t, osAPIclient, 1, 3, "SSLClient")
ostest.SkipIfBelowVersion(t, osAPIclient, 2, 0, "SSLClient")

clientTLSCert, err := tls.LoadX509KeyPair("../../admin.pem", "../../admin.key")
require.Nil(t, err)
Expand Down

0 comments on commit e0b86f4

Please sign in to comment.