Skip to content

Commit ed33f31

Browse files
authored
Fix serverless task (#937)
GODRIVER-2389 Forbid serverless on unified change streams tests. GODRIVER-2214 Update serverless testing for load balancer fronting single proxy.
1 parent 0f7cfc8 commit ed33f31

File tree

10 files changed

+37
-17
lines changed

10 files changed

+37
-17
lines changed

.evergreen/config.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -530,12 +530,10 @@ functions:
530530
export GOFLAGS=-mod=vendor
531531
AUTH="auth" \
532532
SSL="ssl" \
533-
MONGODB_URI="${SINGLE_ATLASPROXY_SERVERLESS_URI}" \
533+
MONGODB_URI="${SERVERLESS_URI}" \
534534
SERVERLESS="serverless" \
535535
SERVERLESS_ATLAS_USER="${SERVERLESS_ATLAS_USER}" \
536536
SERVERLESS_ATLAS_PASSWORD="${SERVERLESS_ATLAS_PASSWORD}" \
537-
SINGLE_MONGOS_LB_URI="${SINGLE_ATLASPROXY_SERVERLESS_URI}" \
538-
MULTI_MONGOS_LB_URI="${MULTI_ATLASPROXY_SERVERLESS_URI}" \
539537
MONGO_GO_DRIVER_COMPRESSOR=${MONGO_GO_DRIVER_COMPRESSOR} \
540538
make evg-test-serverless
541539

data/change-streams/unified/change-streams-pre_and_post_images.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
{
22
"description": "change-streams-pre_and_post_images",
3-
"schemaVersion": "1.0",
3+
"schemaVersion": "1.4",
44
"runOnRequirements": [
55
{
66
"minServerVersion": "6.0.0",
77
"topologies": [
88
"replicaset",
99
"sharded-replicaset",
1010
"load-balanced"
11-
]
11+
],
12+
"serverless": "forbid"
1213
}
1314
],
1415
"createEntities": [

data/change-streams/unified/change-streams-pre_and_post_images.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
description: "change-streams-pre_and_post_images"
22

3-
schemaVersion: "1.3"
3+
schemaVersion: "1.4"
44

55
runOnRequirements:
66
- minServerVersion: "6.0.0"
77
topologies: [ replicaset, sharded-replicaset, load-balanced ]
8+
serverless: forbid
89

910
createEntities:
1011
- client:

data/change-streams/unified/change-streams.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
{
22
"description": "change-streams",
3-
"schemaVersion": "1.0",
3+
"schemaVersion": "1.4",
44
"runOnRequirements": [
55
{
6+
"minServerVersion": "3.6",
67
"topologies": [
78
"replicaset",
89
"sharded-replicaset"
9-
]
10+
],
11+
"serverless": "forbid"
1012
}
1113
],
1214
"createEntities": [

data/change-streams/unified/change-streams.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
description: "change-streams"
2-
schemaVersion: "1.0"
2+
3+
schemaVersion: "1.4"
4+
35
runOnRequirements:
4-
- topologies: [ replicaset, sharded-replicaset ]
6+
- minServerVersion: "3.6"
7+
topologies: [ replicaset, sharded-replicaset ]
8+
serverless: forbid
9+
510
createEntities:
611
- client:
712
id: &client0 client0

data/unified-test-format/valid-pass/poc-change-streams.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
{
22
"description": "poc-change-streams",
3-
"schemaVersion": "1.0",
3+
"schemaVersion": "1.4",
4+
"runOnRequirements": [
5+
{
6+
"serverless": "forbid"
7+
}
8+
],
49
"createEntities": [
510
{
611
"client": {

data/unified-test-format/valid-pass/poc-change-streams.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
description: "poc-change-streams"
22

3-
schemaVersion: "1.0"
3+
schemaVersion: "1.4"
4+
5+
runOnRequirements:
6+
- serverless: forbid
47

58
createEntities:
69
# Entities for creating changeStreams

mongo/integration/mtest/global_state.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ func ClusterURI() string {
3636
return testContext.connString.Original
3737
}
3838

39+
// Serverless returns whether the test is running against a serverless instance.
40+
func Serverless() bool {
41+
return testContext.serverless
42+
}
43+
3944
// SingleMongosLoadBalancerURI returns the URI for a load balancer fronting a single mongos. This will only be set
4045
// if the cluster is load balanced.
4146
func SingleMongosLoadBalancerURI() string {

mongo/integration/mtest/setup.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,10 @@ func Setup(setupOpts ...*SetupOptions) error {
179179
}
180180
}
181181

182-
// For load balanced clusters, retrieve the required LB URIs and add additional information (e.g. TLS options) to
182+
// For non-serverless, load balanced clusters, retrieve the required LB URIs and add additional information (e.g. TLS options) to
183183
// them if necessary.
184-
if testContext.topoKind == LoadBalanced {
184+
testContext.serverless = os.Getenv("SERVERLESS") == "serverless"
185+
if !testContext.serverless && testContext.topoKind == LoadBalanced {
185186
singleMongosURI := os.Getenv("SINGLE_MONGOS_LB_URI")
186187
if singleMongosURI == "" {
187188
return errors.New("SINGLE_MONGOS_LB_URI must be set when running against load balanced clusters")
@@ -203,7 +204,6 @@ func Setup(setupOpts ...*SetupOptions) error {
203204

204205
testContext.authEnabled = os.Getenv("AUTH") == "auth"
205206
testContext.sslEnabled = os.Getenv("SSL") == "ssl"
206-
testContext.serverless = os.Getenv("SERVERLESS") == "serverless"
207207
biRes, err := testContext.client.Database("admin").RunCommand(context.Background(), bson.D{{"buildInfo", 1}}).DecodeBytes()
208208
if err != nil {
209209
return fmt.Errorf("buildInfo error: %v", err)

mongo/integration/unified/client_entity.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,11 @@ func newClientEntity(ctx context.Context, em *EntityMap, entityOptions *entityOp
142142
}
143143

144144
func getURIForClient(opts *entityOptions) string {
145-
if mtest.ClusterTopologyKind() != mtest.LoadBalanced {
145+
if mtest.Serverless() || mtest.ClusterTopologyKind() != mtest.LoadBalanced {
146146
return mtest.ClusterURI()
147147
}
148148

149-
// For load-balanced deployments, UseMultipleMongoses is used to determine the load balancer URI. If set to false,
149+
// For non-serverless load-balanced deployments, UseMultipleMongoses is used to determine the load balancer URI. If set to false,
150150
// the LB fronts a single server. If unset or explicitly true, the LB fronts multiple mongos servers.
151151
switch {
152152
case opts.UseMultipleMongoses != nil && !*opts.UseMultipleMongoses:

0 commit comments

Comments
 (0)