@@ -1691,7 +1691,9 @@ func TestClientSideEncryptionProse(t *testing.T) {
16911691assert .Nil (mt , err , "error on CreateCollection: %v" , err )
16921692err = mt .Client .Database ("keyvault" ).Collection ("datakeys" ).Drop (context .Background ())
16931693assert .Nil (mt , err , "error on Drop: %v" , err )
1694- keyVaultClient , err := mongo .Connect (options .Client ().ApplyURI (mtest .ClusterURI ()))
1694+ opts := options .Client ().ApplyURI (mtest .ClusterURI ())
1695+ integtest .AddTestServerAPIVersion (opts )
1696+ keyVaultClient , err := mongo .Connect (opts )
16951697assert .Nil (mt , err , "error on Connect: %v" , err )
16961698datakeysColl := keyVaultClient .Database ("keyvault" ).Collection ("datakeys" , options .Collection ().SetWriteConcern (mtest .MajorityWc ))
16971699_ , err = datakeysColl .InsertOne (context .Background (), key1Document )
@@ -1709,6 +1711,7 @@ func TestClientSideEncryptionProse(t *testing.T) {
17091711SetKmsProviders (fullKmsProvidersMap ).
17101712SetBypassQueryAnalysis (true )
17111713co := options .Client ().SetAutoEncryptionOptions (aeo ).ApplyURI (mtest .ClusterURI ())
1714+ integtest .AddTestServerAPIVersion (co )
17121715encryptedClient , err := mongo .Connect (co )
17131716assert .Nil (mt , err , "error on Connect: %v" , err )
17141717return encryptedClient , clientEncryption
@@ -2044,6 +2047,7 @@ func TestClientSideEncryptionProse(t *testing.T) {
20442047var keyVaultClient * mongo.Client
20452048{
20462049co := options .Client ().ApplyURI (mtest .ClusterURI ())
2050+ integtest .AddTestServerAPIVersion (co )
20472051keyVaultClient , err = mongo .Connect (co )
20482052defer keyVaultClient .Disconnect (context .Background ())
20492053integtest .AddTestServerAPIVersion (co )
@@ -2086,6 +2090,7 @@ func TestClientSideEncryptionProse(t *testing.T) {
20862090var keyVaultClient * mongo.Client
20872091{
20882092co := options .Client ().ApplyURI (mtest .ClusterURI ())
2093+ integtest .AddTestServerAPIVersion (co )
20892094keyVaultClient , err = mongo .Connect (co )
20902095defer keyVaultClient .Disconnect (context .Background ())
20912096integtest .AddTestServerAPIVersion (co )
@@ -2136,6 +2141,7 @@ func TestClientSideEncryptionProse(t *testing.T) {
21362141var keyVaultClient * mongo.Client
21372142{
21382143co := options .Client ().ApplyURI (mtest .ClusterURI ())
2144+ integtest .AddTestServerAPIVersion (co )
21392145keyVaultClient , err = mongo .Connect (co )
21402146defer keyVaultClient .Disconnect (context .Background ())
21412147integtest .AddTestServerAPIVersion (co )
@@ -2308,6 +2314,7 @@ func TestClientSideEncryptionProse(t *testing.T) {
23082314mt .RunOpts ("21. automatic data encryption keys" , qeRunOpts , func (mt * mtest.T ) {
23092315setup := func () (* mongo.Client , * mongo.ClientEncryption , error ) {
23102316opts := options .Client ().ApplyURI (mtest .ClusterURI ())
2317+ integtest .AddTestServerAPIVersion (opts )
23112318client , err := mongo .Connect (opts )
23122319if err != nil {
23132320return nil , nil , err
@@ -2626,7 +2633,9 @@ func TestClientSideEncryptionProse(t *testing.T) {
26262633assert .Nil (mt , err , "error on CreateCollection: %v" , err )
26272634err = mt .Client .Database ("keyvault" ).Collection ("datakeys" ).Drop (context .Background ())
26282635assert .Nil (mt , err , "error on Drop: %v" , err )
2629- keyVaultClient , err := mongo .Connect (options .Client ().ApplyURI (mtest .ClusterURI ()))
2636+ opts := options .Client ().ApplyURI (mtest .ClusterURI ())
2637+ integtest .AddTestServerAPIVersion (opts )
2638+ keyVaultClient , err := mongo .Connect (opts )
26302639assert .Nil (mt , err , "error on Connect: %v" , err )
26312640datakeysColl := keyVaultClient .Database ("keyvault" ).Collection ("datakeys" , options .Collection ().SetWriteConcern (mtest .MajorityWc ))
26322641_ , err = datakeysColl .InsertOne (context .Background (), key1Document )
@@ -2644,6 +2653,7 @@ func TestClientSideEncryptionProse(t *testing.T) {
26442653SetKmsProviders (fullKmsProvidersMap ).
26452654SetBypassQueryAnalysis (true )
26462655co := options .Client ().SetAutoEncryptionOptions (aeo ).ApplyURI (mtest .ClusterURI ())
2656+ integtest .AddTestServerAPIVersion (co )
26472657encryptedClient , err := mongo .Connect (co )
26482658assert .Nil (mt , err , "error on Connect: %v" , err )
26492659
@@ -2933,7 +2943,9 @@ func TestClientSideEncryptionProse(t *testing.T) {
29332943
29342944testVal := bson.RawValue {Type : bson .TypeInt32 , Value : bsoncore .AppendInt32 (nil , 123 )}
29352945
2936- keyVaultClient , err := mongo .Connect (options .Client ().ApplyURI (mtest .ClusterURI ()))
2946+ opts := options .Client ().ApplyURI (mtest .ClusterURI ())
2947+ integtest .AddTestServerAPIVersion (opts )
2948+ keyVaultClient , err := mongo .Connect (opts )
29372949assert .Nil (mt , err , "error on Connect: %v" , err )
29382950
29392951ceo := options .ClientEncryption ().
@@ -3077,7 +3089,9 @@ func TestClientSideEncryptionProse(t *testing.T) {
30773089for _ , tc := range testCases {
30783090for _ , dataKey := range dataKeys {
30793091mt .Run (fmt .Sprintf ("%s_%s" , tc .name , dataKey .provider ), func (mt * mtest.T ) {
3080- keyVaultClient , err := mongo .Connect (options .Client ().ApplyURI (mtest .ClusterURI ()))
3092+ opts := options .Client ().ApplyURI (mtest .ClusterURI ())
3093+ integtest .AddTestServerAPIVersion (opts )
3094+ keyVaultClient , err := mongo .Connect (opts )
30813095require .NoError (mt , err , "error on Connect: %v" , err )
30823096
30833097ceo := options .ClientEncryption ().
@@ -3110,7 +3124,10 @@ func TestClientSideEncryptionProse(t *testing.T) {
31103124
31113125for _ , dataKey := range dataKeys {
31123126mt .Run (fmt .Sprintf ("Case 3: createDataKey fails after too many retries_%s" , dataKey .provider ), func (mt * mtest.T ) {
3113- keyVaultClient , err := mongo .Connect (options .Client ().ApplyURI (mtest .ClusterURI ()))
3127+ opts := options .Client ().ApplyURI (mtest .ClusterURI ())
3128+ integtest .AddTestServerAPIVersion (opts )
3129+ keyVaultClient , err := mongo .Connect (opts )
3130+
31143131require .NoError (mt , err , "error on Connect: %v" , err )
31153132
31163133ceo := options .ClientEncryption ().
@@ -3187,6 +3204,7 @@ func setup(mt *mtest.T, aeo *options.AutoEncryptionOptions, kvClientOpts *option
31873204cpt .cseColl = cpt .cseClient .Database ("db" ).Collection ("coll" )
31883205}
31893206if ceo != nil {
3207+ integtest .AddTestServerAPIVersion (kvClientOpts )
31903208cpt .kvClient , err = mongo .Connect (kvClientOpts )
31913209assert .Nil (mt , err , "Connect error for ClientEncryption key vault client: %v" , err )
31923210cpt .clientEnc , err = mongo .NewClientEncryption (cpt .kvClient , ceo )
0 commit comments