Skip to content

Commit d9a3b09

Browse files
committed
fix tests
Signed-off-by: Sean Chittenden <sean.chittenden@crowdstrike.com>
1 parent da86565 commit d9a3b09

4 files changed

Lines changed: 6 additions & 6 deletions

File tree

opensearchapi/api_mget_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func TestMGet(t *testing.T) {
5353
context.Background(),
5454
opensearchapi.MGetReq{
5555
Index: testIndex,
56-
Body: strings.NewReader(`{"docs":[{"_id":"1"},{"_id":"2"}]}`),
56+
Body: strings.NewReader(fmt.Sprintf(`{"docs":[{"_id":"%s-1"},{"_id":"%s-2"}]}`, docIDPrefix, docIDPrefix)),
5757
},
5858
)
5959
require.Nil(t, err)

opensearchapi/api_mtermvectors_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func TestMTermvectors(t *testing.T) {
2626
client, err := ostest.NewClient(t)
2727
require.Nil(t, err)
2828

29-
testIndex := "test-mtermvectors"
29+
testIndex := testutil.MustUniqueString(t, "test-mtermvectors")
3030
t.Cleanup(func() {
3131
client.Indices.Delete(t.Context(), opensearchapi.IndicesDeleteReq{Indices: []string{testIndex}})
3232
})
@@ -95,7 +95,7 @@ func TestMTermvectors(t *testing.T) {
9595
t.Context(),
9696
opensearchapi.MTermvectorsReq{
9797
Index: testIndex,
98-
Body: strings.NewReader(`{"ids":[1,2]}`),
98+
Body: strings.NewReader(fmt.Sprintf(`{"ids":["%s-0","%s-1"]}`, docIDPrefix, docIDPrefix)),
9999
},
100100
)
101101
require.Nil(t, err)

opensearchapi/api_termvectors_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func TestTermvectors(t *testing.T) {
2727
client, err := ostest.NewClient(t)
2828
require.Nil(t, err)
2929

30-
testIndex := "test-termvectors"
30+
testIndex := testutil.MustUniqueString(t, "test-termvectors")
3131
t.Cleanup(func() {
3232
client.Indices.Delete(t.Context(), opensearchapi.IndicesDeleteReq{Indices: []string{testIndex}})
3333
})
@@ -96,7 +96,7 @@ func TestTermvectors(t *testing.T) {
9696
context.Background(),
9797
opensearchapi.TermvectorsReq{
9898
Index: testIndex,
99-
DocumentID: "1",
99+
DocumentID: fmt.Sprintf("%s-%d", docIDPrefix, 0),
100100
Body: strings.NewReader(`{"fields":["*"],"offsets":true,"payloads":true,"positions":true,` +
101101
`"term_statistics":true,"field_statistics":true}`),
102102
},

opensearchapi/api_update_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func TestUpdate(t *testing.T) {
5454
opensearchapi.UpdateReq{
5555
Params: opensearchapi.UpdateParams{Source: true},
5656
Index: testIndex,
57-
DocumentID: "1",
57+
DocumentID: fmt.Sprintf("%s-%d", docIDPrefix, 1),
5858
Body: strings.NewReader(`{"script":{"source":"ctx._source.counter += params.count","lang":"painless","params":{"count":4}}}`),
5959
},
6060
)

0 commit comments

Comments
 (0)