@@ -1691,7 +1691,9 @@ func TestClientSideEncryptionProse(t *testing.T) {
1691
1691
assert .Nil (mt , err , "error on CreateCollection: %v" , err )
1692
1692
err = mt .Client .Database ("keyvault" ).Collection ("datakeys" ).Drop (context .Background ())
1693
1693
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 )
1695
1697
assert .Nil (mt , err , "error on Connect: %v" , err )
1696
1698
datakeysColl := keyVaultClient .Database ("keyvault" ).Collection ("datakeys" , options .Collection ().SetWriteConcern (mtest .MajorityWc ))
1697
1699
_ , err = datakeysColl .InsertOne (context .Background (), key1Document )
@@ -1709,6 +1711,7 @@ func TestClientSideEncryptionProse(t *testing.T) {
1709
1711
SetKmsProviders (fullKmsProvidersMap ).
1710
1712
SetBypassQueryAnalysis (true )
1711
1713
co := options .Client ().SetAutoEncryptionOptions (aeo ).ApplyURI (mtest .ClusterURI ())
1714
+ integtest .AddTestServerAPIVersion (co )
1712
1715
encryptedClient , err := mongo .Connect (co )
1713
1716
assert .Nil (mt , err , "error on Connect: %v" , err )
1714
1717
return encryptedClient , clientEncryption
@@ -2044,6 +2047,7 @@ func TestClientSideEncryptionProse(t *testing.T) {
2044
2047
var keyVaultClient * mongo.Client
2045
2048
{
2046
2049
co := options .Client ().ApplyURI (mtest .ClusterURI ())
2050
+ integtest .AddTestServerAPIVersion (co )
2047
2051
keyVaultClient , err = mongo .Connect (co )
2048
2052
defer keyVaultClient .Disconnect (context .Background ())
2049
2053
integtest .AddTestServerAPIVersion (co )
@@ -2086,6 +2090,7 @@ func TestClientSideEncryptionProse(t *testing.T) {
2086
2090
var keyVaultClient * mongo.Client
2087
2091
{
2088
2092
co := options .Client ().ApplyURI (mtest .ClusterURI ())
2093
+ integtest .AddTestServerAPIVersion (co )
2089
2094
keyVaultClient , err = mongo .Connect (co )
2090
2095
defer keyVaultClient .Disconnect (context .Background ())
2091
2096
integtest .AddTestServerAPIVersion (co )
@@ -2136,6 +2141,7 @@ func TestClientSideEncryptionProse(t *testing.T) {
2136
2141
var keyVaultClient * mongo.Client
2137
2142
{
2138
2143
co := options .Client ().ApplyURI (mtest .ClusterURI ())
2144
+ integtest .AddTestServerAPIVersion (co )
2139
2145
keyVaultClient , err = mongo .Connect (co )
2140
2146
defer keyVaultClient .Disconnect (context .Background ())
2141
2147
integtest .AddTestServerAPIVersion (co )
@@ -2308,6 +2314,7 @@ func TestClientSideEncryptionProse(t *testing.T) {
2308
2314
mt .RunOpts ("21. automatic data encryption keys" , qeRunOpts , func (mt * mtest.T ) {
2309
2315
setup := func () (* mongo.Client , * mongo.ClientEncryption , error ) {
2310
2316
opts := options .Client ().ApplyURI (mtest .ClusterURI ())
2317
+ integtest .AddTestServerAPIVersion (opts )
2311
2318
client , err := mongo .Connect (opts )
2312
2319
if err != nil {
2313
2320
return nil , nil , err
@@ -2626,7 +2633,9 @@ func TestClientSideEncryptionProse(t *testing.T) {
2626
2633
assert .Nil (mt , err , "error on CreateCollection: %v" , err )
2627
2634
err = mt .Client .Database ("keyvault" ).Collection ("datakeys" ).Drop (context .Background ())
2628
2635
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 )
2630
2639
assert .Nil (mt , err , "error on Connect: %v" , err )
2631
2640
datakeysColl := keyVaultClient .Database ("keyvault" ).Collection ("datakeys" , options .Collection ().SetWriteConcern (mtest .MajorityWc ))
2632
2641
_ , err = datakeysColl .InsertOne (context .Background (), key1Document )
@@ -2644,6 +2653,7 @@ func TestClientSideEncryptionProse(t *testing.T) {
2644
2653
SetKmsProviders (fullKmsProvidersMap ).
2645
2654
SetBypassQueryAnalysis (true )
2646
2655
co := options .Client ().SetAutoEncryptionOptions (aeo ).ApplyURI (mtest .ClusterURI ())
2656
+ integtest .AddTestServerAPIVersion (co )
2647
2657
encryptedClient , err := mongo .Connect (co )
2648
2658
assert .Nil (mt , err , "error on Connect: %v" , err )
2649
2659
@@ -2933,7 +2943,9 @@ func TestClientSideEncryptionProse(t *testing.T) {
2933
2943
2934
2944
testVal := bson.RawValue {Type : bson .TypeInt32 , Value : bsoncore .AppendInt32 (nil , 123 )}
2935
2945
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 )
2937
2949
assert .Nil (mt , err , "error on Connect: %v" , err )
2938
2950
2939
2951
ceo := options .ClientEncryption ().
@@ -3077,7 +3089,9 @@ func TestClientSideEncryptionProse(t *testing.T) {
3077
3089
for _ , tc := range testCases {
3078
3090
for _ , dataKey := range dataKeys {
3079
3091
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 )
3081
3095
require .NoError (mt , err , "error on Connect: %v" , err )
3082
3096
3083
3097
ceo := options .ClientEncryption ().
@@ -3110,7 +3124,10 @@ func TestClientSideEncryptionProse(t *testing.T) {
3110
3124
3111
3125
for _ , dataKey := range dataKeys {
3112
3126
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
+
3114
3131
require .NoError (mt , err , "error on Connect: %v" , err )
3115
3132
3116
3133
ceo := options .ClientEncryption ().
@@ -3187,6 +3204,7 @@ func setup(mt *mtest.T, aeo *options.AutoEncryptionOptions, kvClientOpts *option
3187
3204
cpt .cseColl = cpt .cseClient .Database ("db" ).Collection ("coll" )
3188
3205
}
3189
3206
if ceo != nil {
3207
+ integtest .AddTestServerAPIVersion (kvClientOpts )
3190
3208
cpt .kvClient , err = mongo .Connect (kvClientOpts )
3191
3209
assert .Nil (mt , err , "Connect error for ClientEncryption key vault client: %v" , err )
3192
3210
cpt .clientEnc , err = mongo .NewClientEncryption (cpt .kvClient , ceo )
0 commit comments