@@ -1691,7 +1691,9 @@ func TestClientSideEncryptionProse(t *testing.T) {
16911691 assert .Nil (mt , err , "error on CreateCollection: %v" , err )
16921692 err = mt .Client .Database ("keyvault" ).Collection ("datakeys" ).Drop (context .Background ())
16931693 assert .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 )
16951697 assert .Nil (mt , err , "error on Connect: %v" , err )
16961698 datakeysColl := 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) {
17091711 SetKmsProviders (fullKmsProvidersMap ).
17101712 SetBypassQueryAnalysis (true )
17111713 co := options .Client ().SetAutoEncryptionOptions (aeo ).ApplyURI (mtest .ClusterURI ())
1714+ integtest .AddTestServerAPIVersion (co )
17121715 encryptedClient , err := mongo .Connect (co )
17131716 assert .Nil (mt , err , "error on Connect: %v" , err )
17141717 return encryptedClient , clientEncryption
@@ -2044,6 +2047,7 @@ func TestClientSideEncryptionProse(t *testing.T) {
20442047 var keyVaultClient * mongo.Client
20452048 {
20462049 co := options .Client ().ApplyURI (mtest .ClusterURI ())
2050+ integtest .AddTestServerAPIVersion (co )
20472051 keyVaultClient , err = mongo .Connect (co )
20482052 defer keyVaultClient .Disconnect (context .Background ())
20492053 integtest .AddTestServerAPIVersion (co )
@@ -2086,6 +2090,7 @@ func TestClientSideEncryptionProse(t *testing.T) {
20862090 var keyVaultClient * mongo.Client
20872091 {
20882092 co := options .Client ().ApplyURI (mtest .ClusterURI ())
2093+ integtest .AddTestServerAPIVersion (co )
20892094 keyVaultClient , err = mongo .Connect (co )
20902095 defer keyVaultClient .Disconnect (context .Background ())
20912096 integtest .AddTestServerAPIVersion (co )
@@ -2136,6 +2141,7 @@ func TestClientSideEncryptionProse(t *testing.T) {
21362141 var keyVaultClient * mongo.Client
21372142 {
21382143 co := options .Client ().ApplyURI (mtest .ClusterURI ())
2144+ integtest .AddTestServerAPIVersion (co )
21392145 keyVaultClient , err = mongo .Connect (co )
21402146 defer keyVaultClient .Disconnect (context .Background ())
21412147 integtest .AddTestServerAPIVersion (co )
@@ -2308,6 +2314,7 @@ func TestClientSideEncryptionProse(t *testing.T) {
23082314 mt .RunOpts ("21. automatic data encryption keys" , qeRunOpts , func (mt * mtest.T ) {
23092315 setup := func () (* mongo.Client , * mongo.ClientEncryption , error ) {
23102316 opts := options .Client ().ApplyURI (mtest .ClusterURI ())
2317+ integtest .AddTestServerAPIVersion (opts )
23112318 client , err := mongo .Connect (opts )
23122319 if err != nil {
23132320 return nil , nil , err
@@ -2626,7 +2633,9 @@ func TestClientSideEncryptionProse(t *testing.T) {
26262633 assert .Nil (mt , err , "error on CreateCollection: %v" , err )
26272634 err = mt .Client .Database ("keyvault" ).Collection ("datakeys" ).Drop (context .Background ())
26282635 assert .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 )
26302639 assert .Nil (mt , err , "error on Connect: %v" , err )
26312640 datakeysColl := 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) {
26442653 SetKmsProviders (fullKmsProvidersMap ).
26452654 SetBypassQueryAnalysis (true )
26462655 co := options .Client ().SetAutoEncryptionOptions (aeo ).ApplyURI (mtest .ClusterURI ())
2656+ integtest .AddTestServerAPIVersion (co )
26472657 encryptedClient , err := mongo .Connect (co )
26482658 assert .Nil (mt , err , "error on Connect: %v" , err )
26492659
@@ -2933,7 +2943,9 @@ func TestClientSideEncryptionProse(t *testing.T) {
29332943
29342944 testVal := 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 )
29372949 assert .Nil (mt , err , "error on Connect: %v" , err )
29382950
29392951 ceo := options .ClientEncryption ().
@@ -3077,7 +3089,9 @@ func TestClientSideEncryptionProse(t *testing.T) {
30773089 for _ , tc := range testCases {
30783090 for _ , dataKey := range dataKeys {
30793091 mt .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 )
30813095 require .NoError (mt , err , "error on Connect: %v" , err )
30823096
30833097 ceo := options .ClientEncryption ().
@@ -3110,7 +3124,10 @@ func TestClientSideEncryptionProse(t *testing.T) {
31103124
31113125 for _ , dataKey := range dataKeys {
31123126 mt .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+
31143131 require .NoError (mt , err , "error on Connect: %v" , err )
31153132
31163133 ceo := options .ClientEncryption ().
@@ -3187,6 +3204,7 @@ func setup(mt *mtest.T, aeo *options.AutoEncryptionOptions, kvClientOpts *option
31873204 cpt .cseColl = cpt .cseClient .Database ("db" ).Collection ("coll" )
31883205 }
31893206 if ceo != nil {
3207+ integtest .AddTestServerAPIVersion (kvClientOpts )
31903208 cpt .kvClient , err = mongo .Connect (kvClientOpts )
31913209 assert .Nil (mt , err , "Connect error for ClientEncryption key vault client: %v" , err )
31923210 cpt .clientEnc , err = mongo .NewClientEncryption (cpt .kvClient , ceo )
0 commit comments