Skip to content

Commit 7c5d45b

Browse files
committed
minor updates
1 parent 29c4d0b commit 7c5d45b

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

internal/integration/mtest/options.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ var (
5151

5252
// CSFLEOptions holds configuration for Client-Side Field Level Encryption
5353
// (CSFLE).
54-
type CSFLEOptions struct{}
54+
type CSFLEOptions struct {
55+
MinVer string `bson:"minLibmongocryptVersion"`
56+
}
5557

5658
// CSFLE models the runOnRequirements.csfle field in Unified Test Format tests.
5759
//
@@ -72,7 +74,7 @@ type CSFLE struct {
7274
func (csfle *CSFLE) UnmarshalBSON(data []byte) error {
7375
embRawValue := bson.RawValue{Type: bson.TypeEmbeddedDocument, Value: data}
7476
if err := embRawValue.Unmarshal(&csfle.Options); err == nil {
75-
csfle.Boolean = false
77+
csfle.Boolean = true
7678

7779
return nil
7880
}

internal/integration/unified/entity.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,13 @@ var (
3434
tlsClientCertificateKeyFile = os.Getenv("CSFLE_TLS_CLIENT_CERT_FILE")
3535
)
3636

37-
var placeholderDoc = bsoncore.NewDocumentBuilder().AppendInt32("$$placeholder", 1).Build()
37+
var (
38+
// qeCollectionPattern matches collections automatically created for
39+
// queryable encryption.
40+
qeCollectionPattern = regexp.MustCompile("^enxcol_.*.e(sc|coc)$")
41+
42+
placeholderDoc = bsoncore.NewDocumentBuilder().AppendInt32("$$placeholder", 1).Build()
43+
)
3844

3945
const defaultLocalKeyBase64 = "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk"
4046

@@ -510,15 +516,14 @@ func (em *EntityMap) close(ctx context.Context) []error {
510516
}
511517

512518
// Clear automatically created collections used for queryable encryption
513-
re := regexp.MustCompile("^enxcol_.*.e(sc|coc)$")
514519
for id, db := range em.dbEntites {
515520
colls, err := db.ListCollectionNames(ctx, bson.D{})
516521
if err != nil {
517522
errs = append(errs, fmt.Errorf("error listing collections in database with ID %q: %w", id, err))
518523
continue
519524
}
520525
for _, coll := range colls {
521-
if re.MatchString(coll) {
526+
if qeCollectionPattern.MatchString(coll) {
522527
err = db.Collection(coll).Drop(ctx)
523528
if err != nil {
524529
errs = append(errs, fmt.Errorf("error clearing collection %q: %w", coll, err))
@@ -710,9 +715,6 @@ func getKmsProvider(key string, opt bson.Raw) (map[string]any, error) {
710715
default:
711716
return nil, fmt.Errorf("unrecognized KMS provider: %s", key)
712717
}
713-
if len(provider) == 0 {
714-
return nil, nil
715-
}
716718
return provider, nil
717719
}
718720

@@ -726,7 +728,7 @@ func (em *EntityMap) addClientEncryptionEntity(entityOptions *entityOptions) err
726728
if err != nil {
727729
return err
728730
}
729-
if provider == nil {
731+
if len(provider) == 0 {
730732
continue
731733
}
732734
kmsProviders[key] = provider

0 commit comments

Comments
 (0)