Skip to content

Commit

Permalink
opensearchapi: skip render search template test if secure and version…
Browse files Browse the repository at this point in the history
… 2.11 or 2.10

Signed-off-by: Jakob Hahn <jakob.hahn@hetzner.com>
  • Loading branch information
Jakob3xD committed Mar 13, 2024
1 parent e254655 commit 334224d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions opensearchapi/api_render_search_template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@
package opensearchapi_test

import (
"context"
"fmt"
"os"
"strings"
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/opensearch-project/opensearch-go/v3"
ostest "github.com/opensearch-project/opensearch-go/v3/internal/test"
"github.com/opensearch-project/opensearch-go/v3/opensearchapi"
osapitest "github.com/opensearch-project/opensearch-go/v3/opensearchapi/internal/test"
Expand All @@ -25,6 +28,16 @@ func TestRenderSearchTemplate(t *testing.T) {
client, err := ostest.NewClient()
require.Nil(t, err)

if os.Getenv("SECURE_INTEGRATION") == "true" {
resp, err := client.Info(context.Background(), nil)
assert.Nil(t, err)
major, patch, _, err := opensearch.ParseVersion(resp.Version.Number)
assert.Nil(t, err)
if major == 2 && (patch == 10 || patch == 11) {
t.Skipf("Skiping %s due to: https://github.com/opensearch-project/security/issues/3672", t.Name())
}
}

testScript := "test-search-template"
t.Cleanup(func() {
client.Script.Delete(nil, opensearchapi.ScriptDeleteReq{ScriptID: testScript})
Expand Down

0 comments on commit 334224d

Please sign in to comment.