Skip to content

Commit b000132

Browse files
committed
updates
1 parent 54766aa commit b000132

File tree

6 files changed

+26
-4
lines changed

6 files changed

+26
-4
lines changed

internal/integration/unified/collection_data.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ type collectionData struct {
2929
type createOptions struct {
3030
Capped *bool `bson:"capped"`
3131
SizeInBytes *int64 `bson:"size"`
32-
EncryptedFields any `bson:"encryptedFields"`
32+
EncryptedFields bson.Raw `bson:"encryptedFields"`
3333
Validator bson.Raw `bson:"validator"`
3434
}
3535

internal/integration/unified/database_operation_execution.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ func executeCreateCollection(ctx context.Context, operation *operation) (*operat
127127
cco.SetClusteredIndex(val.Document())
128128
case "validator":
129129
cco.SetValidator(val.Document())
130+
case "encryptedFields":
131+
cco.SetEncryptedFields(val.Document())
130132
default:
131133
return nil, fmt.Errorf("unrecognized createCollection option %q", key)
132134
}
@@ -158,13 +160,17 @@ func executeDropCollection(ctx context.Context, operation *operation) (*operatio
158160
return nil, err
159161
}
160162

163+
dco := options.DropCollection()
164+
161165
var collName string
162166
elems, _ := operation.Arguments.Elements()
163167
for _, elem := range elems {
164168
key := elem.Key()
165169
val := elem.Value()
166170

167171
switch key {
172+
case "encryptedFields":
173+
dco.SetEncryptedFields(val.Document())
168174
case "collection":
169175
collName = val.StringValue()
170176
default:
@@ -175,7 +181,7 @@ func executeDropCollection(ctx context.Context, operation *operation) (*operatio
175181
return nil, newMissingArgumentError("collection")
176182
}
177183

178-
err = db.Collection(collName).Drop(ctx)
184+
err = db.Collection(collName).Drop(ctx, dco)
179185
return newErrorResult(err), nil
180186
}
181187

internal/integration/unified/entity.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"bytes"
1111
"context"
1212
"crypto/tls"
13+
"encoding/base64"
1314
"errors"
1415
"fmt"
1516
"os"
@@ -685,7 +686,11 @@ func getKmsProvider(key string, opt bson.Raw) (map[string]any, error) {
685686
return nil, err
686687
}
687688
if v != nil {
688-
provider["key"] = v
689+
b, err := base64.StdEncoding.DecodeString(v.(string))
690+
if err != nil {
691+
return nil, err
692+
}
693+
provider["key"] = b
689694
}
690695
default:
691696
return nil, fmt.Errorf("unrecognized KMS provider: %s", key)

internal/integration/unified/error.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ type clientBulkWriteException struct {
4242
// will perform any other assertions required by the expectedError object. An error is returned if any checks fail.
4343
func verifyOperationError(ctx context.Context, expected *expectedError, result *operationResult) error {
4444
if expected == nil {
45-
if result.Err != nil {
45+
if result != nil && result.Err != nil {
4646
return fmt.Errorf("expected no error, but got %w", result.Err)
4747
}
4848
return nil

internal/integration/unified/operation.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,11 @@ func (op *operation) run(ctx context.Context, loopDone <-chan struct{}) (*operat
274274
return executeAddKeyAltName(ctx, op)
275275
case "decrypt":
276276
return executeDecrypt(ctx, op)
277+
case "assertIndexNotExists":
278+
db := lookupString(op.Arguments, "databaseName")
279+
coll := lookupString(op.Arguments, "collectionName")
280+
index := lookupString(op.Arguments, "indexName")
281+
return nil, verifyIndexExists(ctx, db, coll, index, false)
277282

278283
// Unsupported operations
279284
case "count", "listIndexNames", "mapReduce":

internal/spectest/skip.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,12 @@ var skipTests = map[string][]string{
392392
"TestClientSideEncryptionSpec/timeoutMS.json/timeoutMS_applied_to_listCollections_to_get_collection_schema",
393393
},
394394

395+
// TODO(GODRIVER-3403): Support QE with Client.bulkWrite
396+
"Support QE with Client.bulkWrite (GODRIVER-3403)": {
397+
"TestUnifiedSpec/client-side-encryption/tests/unified/client-bulkWrite-qe.json/client_bulkWrite_QE_replaceOne",
398+
"TestUnifiedSpec/client-side-encryption/tests/unified/client-bulkWrite-qe.json/client_bulkWrite_QE_with_multiple_replace_fails",
399+
},
400+
395401
// TODO(GODRIVER-3076): CSFLE/QE Support for more than 1 KMS provider per
396402
// type.
397403
"Support multiple KMS providers per type (GODRIVER-3076)": {

0 commit comments

Comments
 (0)