Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GODRIVER-3519 Test sharded clusters with requireApiVersion=1 #1997

Merged
merged 2 commits into from
Mar 26, 2025

Conversation

blink1073
Copy link
Member

GODRIVER-3519

Summary

Add tests for sharded clusters with requireApiVersion=1

Background & Motivation

Previously we were only testing with standalone servers. We are now unblocked from testing on sharded clusters, but not yet on replica sets.

@mongodb-drivers-pr-bot mongodb-drivers-pr-bot bot added the priority-3-low Low Priority PR for Review label Mar 25, 2025
Copy link
Contributor

API Change Report

No changes found!

@blink1073
Copy link
Member Author

I am seeing some failures as a result of the api version not being set in some of the encryption prose tests, but I couldn't figure out how to handle them.

https://spruce.mongodb.com/version/67e30caf40b6aa0007d94b6c/tasks?sorts=STATUS%3AASC%3BBASE_STATUS%3ADESC

[2025/03/25 15:24:52.475] === NAME TestClientSideEncryptionProse/12._explicit_encryption [2025/03/25 15:24:52.475] client_side_encryption_prose_test.go:1698: [2025/03/25 15:24:52.475] Error Trace: /data/mci/fe01f8c411c05606a12337b8cc3c283f/src/go.mongodb.org/mongo-driver/internal/integration/client_side_encryption_prose_test.go:1698 [2025/03/25 15:24:52.475] /data/mci/fe01f8c411c05606a12337b8cc3c283f/src/go.mongodb.org/mongo-driver/internal/integration/client_side_encryption_prose_test.go:1719 [2025/03/25 15:24:52.475] /data/mci/fe01f8c411c05606a12337b8cc3c283f/src/go.mongodb.org/mongo-driver/internal/integration/mongotest.go:232 [2025/03/25 15:24:52.475] Error: Expected nil, but got: topology.ServerSelectionError{Desc:description.Topology{Servers:[]description.Server{description.Server{Addr:"localhost:27018", Arbiters:[]string(nil), AverageRTT:0, AverageRTTSet:false, Compression:[]string(nil), CanonicalAddr:"", ElectionID:bson.ObjectID{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, HeartbeatInterval:0, HelloOK:false, Hosts:[]string(nil), IsCryptd:false, LastError:driver.Error{Code:498870, Message:"The apiVersion parameter is required, please configure your MongoClient's API version", Labels:[]string(nil), Name:"Location498870", Wrapped:error(nil), TopologyVersion:(*description.TopologyVersion)(nil), Raw:bsoncore.Document{0x17, 0x1, 0x0, 0x0, 0x1, 0x6f, 0x6b, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0x65, 0x72, 0x72, 0x6d, 0x73, 0x67, 0x0, 0x56, 0x0, 0x0, 0x0, 0x54, 0x68, 0x65, 0x20, 0x61, 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x20, 0x69, 0x73, 0x20, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x2c, 0x20, 0x70, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x20, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x65, 0x20, 0x79, 0x6f, 0x75, 0x72, 0x20, 0x4d, 0x6f, 0x6e, 0x67, 0x6f, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x27, 0x73, 0x20, 0x41, 0x50, 0x49, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x0, 0x10, 0x63, 0x6f, 0x64, 0x65, 0x0, 0xb6, 0x9c, 0x7, 0x0, 0x2, 0x63, 0x6f, 0x64, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x0, 0xf, 0x0, 0x0, 0x0, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x34, 0x39, 0x38, 0x38, 0x37, 0x30, 0x0, 0x3, 0x24, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x54, 0x69, 0x6d, 0x65, 0x0, 0x58, 0x0, 0x0, 0x0, 0x11, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x54, 0x69, 0x6d, 0x65, 0x0, 0x2, 0x0, 0x0, 0x0, 0x43, 0x10, 0xe3, 0x67, 0x3, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x0, 0x33, 0x0, 0x0, 0x0, 0x5, 0x68, 0x61, 0x73, 0x68, 0x0, 0x14, 0x0, 0x0, 0x0, 0x0, 0x8d, 0x60, 0x6b, 0x6d, 0xde, 0x68, 0xce, 0x7a, 0x3f, 0x6f, 0x24, 0xb8, 0xcf, 0x37, 0x38, 0x86, 0xb1, 0xc4, 0xd2, 0x97, 0x12, 0x6b, 0x65, 0x79, 0x49, 0x64, 0x0, 0x1a, 0x0, 0x0, 0x0, 0x6e, 0xd, 0xe3, 0x67, 0x0, 0x0, 0x11, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x0, 0x2, 0x0, 0x0, 0x0, 0x43, 0x10, 0xe3, 0x67, 0x0}}, LastUpdateTime:time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), LastWriteTime:time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), MaxBatchCount:0x0, MaxDocumentSize:0x0, MaxMessageSize:0x0, Members:[]address.Address(nil), Passives:[]string(nil), Passive:false, Primary:"", ReadOnly:false, ServiceID:(*bson.ObjectID)(nil), SessionTimeoutMinutes:(*int64)(nil), SetName:"", SetVersion:0x0, Tags:tag.Set(nil), TopologyVersion:(*description.TopologyVersion)(nil), Kind:0x0, WireVersion:(*description.VersionRange)(nil)}, description.Server{Addr:"localhost:27017", Arbiters:[]string(nil), AverageRTT:0, AverageRTTSet:false, Compression:[]string(nil), CanonicalAddr:"", ElectionID:bson.ObjectID{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, HeartbeatInterval:0, HelloOK:false, Hosts:[]string(nil), IsCryptd:false, LastError:driver.Error{Code:498870, Message:"The apiVersion parameter is required, please configure your MongoClient's API version", Labels:[]string(nil), Name:"Location498870", Wrapped:error(nil), TopologyVersion:(*description.TopologyVersion)(nil), Raw:bsoncore.Document{0x17, 0x1, 0x0, 0x0, 0x1, 0x6f, 0x6b, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0x65, 0x72, 0x72, 0x6d, 0x73, 0x67, 0x0, 0x56, 0x0, 0x0, 0x0, 0x54, 0x68, 0x65, 0x20, 0x61, 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x20, 0x69, 0x73, 0x20, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x2c, 0x20, 0x70, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x20, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x65, 0x20, 0x79, 0x6f, 0x75, 0x72, 0x20, 0x4d, 0x6f, 0x6e, 0x67, 0x6f, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x27, 0x73, 0x20, 0x41, 0x50, 0x49, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x0, 0x10, 0x63, 0x6f, 0x64, 0x65, 0x0, 0xb6, 0x9c, 0x7, 0x0, 0x2, 0x63, 0x6f, 0x64, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x0, 0xf, 0x0, 0x0, 0x0, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x34, 0x39, 0x38, 0x38, 0x37, 0x30, 0x0, 0x3, 0x24, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x54, 0x69, 0x6d, 0x65, 0x0, 0x58, 0x0, 0x0, 0x0, 0x11, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x54, 0x69, 0x6d, 0x65, 0x0, 0x3, 0x0, 0x0, 0x0, 0x43, 0x10, 0xe3, 0x67, 0x3, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x0, 0x33, 0x0, 0x0, 0x0, 0x5, 0x68, 0x61, 0x73, 0x68, 0x0, 0x14, 0x0, 0x0, 0x0, 0x0, 0x8d, 0x60, 0x6b, 0x6d, 0xde, 0x68, 0xce, 0x7a, 0x3f, 0x6f, 0x24, 0xb8, 0xcf, 0x37, 0x38, 0x86, 0xb1, 0xc4, 0xd2, 0x97, 0x12, 0x6b, 0x65, 0x79, 0x49, 0x64, 0x0, 0x1a, 0x0, 0x0, 0x0, 0x6e, 0xd, 0xe3, 0x67, 0x0, 0x0, 0x11, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x0, 0x3, 0x0, 0x0, 0x0, 0x43, 0x10, 0xe3, 0x67, 0x0}}, LastUpdateTime:time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), LastWriteTime:time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), MaxBatchCount:0x0, MaxDocumentSize:0x0, MaxMessageSize:0x0, Members:[]address.Address(nil), Passives:[]string(nil), Passive:false, Primary:"", ReadOnly:false, ServiceID:(*bson.ObjectID)(nil), SessionTimeoutMinutes:(*int64)(nil), SetName:"", SetVersion:0x0, Tags:tag.Set(nil), TopologyVersion:(*description.TopologyVersion)(nil), Kind:0x0, WireVersion:(*description.VersionRange)(nil)}}, SetName:"", Kind:0x0, SessionTimeoutMinutes:(*int64)(nil), CompatibilityErr:error(nil)}, Wrapped:context.deadlineExceededError{}} [2025/03/25 15:24:52.475] Test: TestClientSideEncryptionProse/12._explicit_encryption [2025/03/25 15:24:52.475] Messages: error on InsertOne: server selection error: context deadline exceeded, current topology: { Type: Unknown, Servers: [{ Addr: localhost:27018, Type: Unknown, Last error: (Location498870) The apiVersion parameter is required, please configure your MongoClient's API version }, { Addr: localhost:27017, Type: Unknown, Last error: (Location498870) The apiVersion parameter is required, please configure your MongoClient's API version }, ] }

@matthewdale
Copy link
Collaborator

@blink1073 I believe you need to use integtest.AddTestServerAPIVersion to add the API Version anywhere that connects a Client via mongo.Connect in the CSE prose tests.

For example, this line should be replaced with

opts := options.Client().ApplyURI(mtest.ClusterURI())
integtest.AddTestServerAPIVersion(opts)
keyVaultClient, err := mongo.Connect(opts)

I haven't tested that, but other uses of integtest.AddTestServerAPIVersion seem to suggest that it should work. There are 17 calls to mongo.Connect in client_side_encryption_prose_test.go, I think all of them need to have the API Version added.

@blink1073
Copy link
Member Author

Cheers, I'll give that a shot.

@blink1073
Copy link
Member Author

Copy link
Member

@prestonvasquez prestonvasquez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🔧

@blink1073 blink1073 merged commit 7f110b5 into mongodb:master Mar 26, 2025
31 of 34 checks passed
@blink1073 blink1073 deleted the GODRIVER-3519 branch March 26, 2025 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority-3-low Low Priority PR for Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants