Skip to content

Commit b9cbcf2

Browse files
committed
WIP
1 parent 5914375 commit b9cbcf2

File tree

7 files changed

+41
-343
lines changed

7 files changed

+41
-343
lines changed

.evergreen/config.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ timeout:
2626
args: [ls, -la]
2727

2828
functions:
29-
assume-test-secrets-ec2-role:
30-
- command: ec2.assume_role
31-
params:
32-
role_arn: ${aws_test_secrets_role}
33-
3429
setup-system:
3530
# Executes clone and applies the submitted patch, if any
3631
- command: git.get_project

Taskfile.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ tasks:
161161
evg-test-search-index:
162162
# Use the long timeout to wait for the responses from the server.
163163
- go test ./internal/integration -run TestSearchIndexProse -v -timeout {{.LONG_TEST_TIMEOUT}}s >> test.suite
164+
- go test ./internal/integration -run TestSearchIndex -v -timeout {{.LONG_TEST_TIMEOUT}}s >> test.suite
164165

165166
evg-test-ocsp:
166167
- go test -v ./mongo -run TestOCSP ${OCSP_TLS_SHOULD_SUCCEED} >> test.suite

go.work

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,4 @@ use (
1010
./internal/cmd/faas/awslambda/mongodb
1111
./internal/test/compilecheck
1212
./internal/test/goleak
13-
./mongo/test
1413
)

internal/integration/mongointernal_test.go

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

1111
import (
1212
"context"
13+
"os"
1314
"testing"
15+
"time"
1416

1517
"go.mongodb.org/mongo-driver/v2/bson"
1618
"go.mongodb.org/mongo-driver/v2/internal/assert"
1719
"go.mongodb.org/mongo-driver/v2/internal/integration/mtest"
1820
"go.mongodb.org/mongo-driver/v2/internal/require"
1921
"go.mongodb.org/mongo-driver/v2/mongo"
22+
"go.mongodb.org/mongo-driver/v2/mongo/options"
2023
"go.mongodb.org/mongo-driver/v2/x/bsonx/bsoncore"
2124
)
2225

@@ -96,3 +99,40 @@ func TestNewSessionWithLSID(t *testing.T) {
9699
t.Errorf("expected ClientSession.SetServer to panic")
97100
})
98101
}
102+
103+
func TestSearchIndex(t *testing.T) {
104+
t.Parallel()
105+
106+
const timeout = 5 * time.Minute
107+
108+
uri := os.Getenv("TEST_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+
v2bson.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 := v2bson.D{
129+
{"mappings", v2bson.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+
}

mongo/test/go.mod

Lines changed: 0 additions & 72 deletions
This file was deleted.

0 commit comments

Comments
 (0)