Skip to content

Commit 0701937

Browse files
committed
WIP
1 parent 7493825 commit 0701937

File tree

4 files changed

+58
-42
lines changed

4 files changed

+58
-42
lines changed

.evergreen/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2058,7 +2058,7 @@ task_groups:
20582058
params:
20592059
working_dir: src/go.mongodb.org/mongo-driver
20602060
binary: bash
2061-
include_expansions_in_env: [AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN]
2061+
include_expansions_in_env: [AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN, MONGODB_URI]
20622062
env:
20632063
MONGODB_VERSION: ${VERSION}
20642064
LAMBDA_STACK_NAME: dbx-go-lambda

Taskfile.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ tasks:
160160

161161
evg-test-search-index:
162162
# Use the long timeout to wait for the responses from the server.
163-
- go test ./internal/integration -run TestSearchIndexProse -v -timeout {{.LONG_TEST_TIMEOUT}}s >> test.suite
164163
- go test ./internal/integration -run TestSearchIndex -v -timeout {{.LONG_TEST_TIMEOUT}}s >> test.suite
165164

166165
evg-test-ocsp:

internal/integration/mongointernal_test.go

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,13 @@ package integration
1010

1111
import (
1212
"context"
13-
"os"
1413
"testing"
15-
"time"
1614

1715
"go.mongodb.org/mongo-driver/v2/bson"
1816
"go.mongodb.org/mongo-driver/v2/internal/assert"
1917
"go.mongodb.org/mongo-driver/v2/internal/integration/mtest"
2018
"go.mongodb.org/mongo-driver/v2/internal/require"
2119
"go.mongodb.org/mongo-driver/v2/mongo"
22-
"go.mongodb.org/mongo-driver/v2/mongo/options"
2320
"go.mongodb.org/mongo-driver/v2/x/bsonx/bsoncore"
2421
)
2522

@@ -99,40 +96,3 @@ func TestNewSessionWithLSID(t *testing.T) {
9996
t.Errorf("expected ClientSession.SetServer to panic")
10097
})
10198
}
102-
103-
func TestSearchIndex(t *testing.T) {
104-
t.Parallel()
105-
106-
const timeout = 5 * time.Minute
107-
108-
uri := os.Getenv("SEARCH_INDEX_URI")
109-
if uri == "" {
110-
t.Skip("skipping")
111-
}
112-
113-
opts := options.Client().ApplyURI(uri).SetTimeout(timeout)
114-
mt := mtest.New(t, mtest.NewOptions().ClientOptions(opts).MinServerVersion("7.0").Topologies(mtest.ReplicaSet))
115-
116-
mt.Run("search indexes with empty option", func(mt *mtest.T) {
117-
ctx := context.Background()
118-
119-
_, err := mt.Coll.InsertMany(ctx, []interface{}{
120-
bson.M{
121-
"string_field": "test1 test1",
122-
},
123-
})
124-
require.NoError(mt, err, "failed to insert")
125-
126-
view := mt.Coll.SearchIndexes()
127-
128-
definition := bson.D{
129-
{"mappings", bson.D{
130-
{"dynamic", true},
131-
}},
132-
}
133-
_, err = view.CreateOne(ctx, mongo.SearchIndexModel{
134-
Definition: definition,
135-
})
136-
require.NoError(mt, err, "failed to create index")
137-
})
138-
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// Copyright (C) MongoDB, Inc. 2025-present.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License"); you may
4+
// not use this file except in compliance with the License. You may obtain
5+
// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6+
7+
package integration
8+
9+
import (
10+
"context"
11+
"os"
12+
"testing"
13+
"time"
14+
15+
"go.mongodb.org/mongo-driver/v2/bson"
16+
"go.mongodb.org/mongo-driver/v2/internal/integration/mtest"
17+
"go.mongodb.org/mongo-driver/v2/internal/require"
18+
"go.mongodb.org/mongo-driver/v2/mongo"
19+
"go.mongodb.org/mongo-driver/v2/mongo/options"
20+
)
21+
22+
func TestSearchIndex(t *testing.T) {
23+
t.Parallel()
24+
25+
const timeout = 5 * time.Minute
26+
27+
uri := os.Getenv("SEARCH_INDEX_URI")
28+
if uri == "" {
29+
t.Skip("skipping")
30+
}
31+
32+
opts := options.Client().ApplyURI(uri).SetTimeout(timeout)
33+
mt := mtest.New(t, mtest.NewOptions().ClientOptions(opts).MinServerVersion("7.0").Topologies(mtest.ReplicaSet))
34+
35+
mt.Run("search indexes with empty option", func(mt *mtest.T) {
36+
ctx := context.Background()
37+
38+
_, err := mt.Coll.InsertMany(ctx, []interface{}{
39+
bson.M{
40+
"string_field": "test1 test1",
41+
},
42+
})
43+
require.NoError(mt, err, "failed to insert")
44+
45+
view := mt.Coll.SearchIndexes()
46+
47+
definition := bson.D{
48+
{"mappings", bson.D{
49+
{"dynamic", true},
50+
}},
51+
}
52+
_, err = view.CreateOne(ctx, mongo.SearchIndexModel{
53+
Definition: definition,
54+
})
55+
require.NoError(mt, err, "failed to create index")
56+
})
57+
}

0 commit comments

Comments
 (0)