Skip to content

Commit ad74978

Browse files
committed
Fix: skip if below test cases.
Signed-off-by: dblock <[email protected]>
1 parent ea08582 commit ad74978

File tree

7 files changed

+15
-21
lines changed

7 files changed

+15
-21
lines changed

.github/workflows/test-compatibility.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- uses: actions/checkout@v4
3333

3434
- uses: actions/setup-go@v5
35-
with: { go-version-file: "go.mod" }
35+
with: { go-version-file: 'go.mod' }
3636

3737
- run: go version
3838

.github/workflows/test-integration-unreleased.yml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
name: Integration with Unreleased OpenSearch
22

3-
on:
4-
push:
5-
branches:
6-
- "main"
7-
pull_request:
8-
branches:
9-
- "main"
3+
on: [push, pull_request]
104

115
jobs:
126
test:
@@ -15,9 +9,9 @@ jobs:
159
fail-fast: false
1610
matrix:
1711
entry:
18-
- { branch: "1.x", java-version: "11" }
19-
- { branch: "2.x", java-version: "17" }
20-
- { branch: "main", java-version: "17" }
12+
- { branch: '1.x', java-version: '11' }
13+
- { branch: '2.x', java-version: '17' }
14+
- { branch: 'main', java-version: '17' }
2115
steps:
2216
- name: Checkout OpenSearch
2317
uses: actions/checkout@v4
@@ -40,7 +34,7 @@ jobs:
4034

4135
- uses: actions/setup-java@v4
4236
with:
43-
distribution: "temurin"
37+
distribution: 'temurin'
4438
java-version: ${{ matrix.entry.java-version }}
4539

4640
- name: Assemble OpenSearch
@@ -69,7 +63,7 @@ jobs:
6963

7064
- name: Setup Go
7165
uses: actions/setup-go@v5
72-
with: { go-version-file: "go-client/go.mod" }
66+
with: { go-version-file: 'go-client/go.mod' }
7367

7468
- name: Integration test
7569
working-directory: go-client

internal/test/helper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ func SkipIfBelowVersion(t *testing.T, client *opensearchapi.Client, majorVersion
105105
t.Helper()
106106
major, patch, _, err := GetVersion(client)
107107
assert.Nil(t, err)
108-
if major <= majorVersion && patch <= patchVersion {
108+
if major < majorVersion || (major == majorVersion && patch < patchVersion) {
109109
t.Skipf("Skiping %s as version %d.%d.x does not support this endpoint", testName, major, patch)
110110
}
111111
}

opensearchapi/api_cat_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ func TestCatClient(t *testing.T) {
366366
for catType, value := range testCases {
367367
t.Run(catType, func(t *testing.T) {
368368
if catType == "ClusterManager" {
369-
ostest.SkipIfBelowVersion(t, client, 1, 3, catType)
369+
ostest.SkipIfBelowVersion(t, client, 2, 0, catType)
370370
}
371371
for _, testCase := range value {
372372
t.Run(testCase.Name, func(t *testing.T) {
@@ -399,7 +399,7 @@ func TestCatClient(t *testing.T) {
399399
ostest.CompareRawJSONwithParsedJSON(t, resp.Allocations, resp.Inspect().Response)
400400
})
401401
t.Run("ClusterManager", func(t *testing.T) {
402-
ostest.SkipIfBelowVersion(t, client, 1, 3, "ClusterManager")
402+
ostest.SkipIfBelowVersion(t, client, 2, 0, "ClusterManager")
403403
resp, err := client.Cat.ClusterManager(nil, nil)
404404
assert.Nil(t, err)
405405
assert.NotNil(t, resp)

opensearchapi/api_cluster_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ func TestClusterClient(t *testing.T) {
230230
for catType, value := range testCases {
231231
t.Run(catType, func(t *testing.T) {
232232
if strings.Contains(catType, "Decommission") {
233-
ostest.SkipIfBelowVersion(t, client, 2, 3, catType)
233+
ostest.SkipIfBelowVersion(t, client, 2, 4, catType)
234234
}
235235
for _, testCase := range value {
236236
t.Run(testCase.Name, func(t *testing.T) {

opensearchapi/api_script_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ func TestScriptClient(t *testing.T) {
155155
for _, value := range testCases {
156156
t.Run(value.Name, func(t *testing.T) {
157157
if strings.Contains(value.Name, "Language") {
158-
ostest.SkipIfBelowVersion(t, client, 2, 3, value.Name)
158+
ostest.SkipIfBelowVersion(t, client, 2, 4, value.Name)
159159
}
160160
for _, testCase := range value.Tests {
161161
t.Run(testCase.Name, func(t *testing.T) {
@@ -206,7 +206,7 @@ func TestScriptClient(t *testing.T) {
206206
ostest.CompareRawJSONwithParsedJSON(t, resp, resp.Inspect().Response)
207207
})
208208
t.Run("Language", func(t *testing.T) {
209-
ostest.SkipIfBelowVersion(t, client, 2, 3, "Language")
209+
ostest.SkipIfBelowVersion(t, client, 2, 4, "Language")
210210
resp, err := client.Script.Language(nil, nil)
211211
require.Nil(t, err)
212212
assert.NotNil(t, resp)

plugins/security/api_ssl_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func TestSSLClient(t *testing.T) {
3030
osAPIclient, err := ostest.NewClient()
3131
require.Nil(t, err)
3232

33-
ostest.SkipIfBelowVersion(t, osAPIclient, 1, 3, "SSLClient")
33+
ostest.SkipIfBelowVersion(t, osAPIclient, 2, 0, "SSLClient")
3434

3535
clientTLSCert, err := tls.LoadX509KeyPair("../../admin.pem", "../../admin.key")
3636
require.Nil(t, err)
@@ -114,7 +114,7 @@ func TestSSLClient(t *testing.T) {
114114
for _, testCase := range value.Tests {
115115
t.Run(testCase.Name, func(t *testing.T) {
116116
if strings.HasSuffix(value.Name, "Reload") && strings.Contains(testCase.Name, "request") {
117-
ostest.SkipIfBelowVersion(t, osAPIclient, 2, 7, value.Name)
117+
ostest.SkipIfBelowVersion(t, osAPIclient, 2, 8, value.Name)
118118
}
119119
res, err := testCase.Results()
120120
if testCase.Name == "inspect" {

0 commit comments

Comments
 (0)