Skip to content

Commit 9705a6c

Browse files
committed
Fix the erroneous runOnRequirements CSFLE disabled check in mtest.
1 parent ad40e61 commit 9705a6c

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

internal/integration/mtest/mongotest.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -802,10 +802,10 @@ func verifyRunOnBlockConstraint(rob RunOnBlock) error {
802802
if rob.CSFLEEnabled() && rob.CSFLE.Options != nil {
803803
return fmt.Errorf("auto encryption required (GODRIVER-3486)")
804804
}
805-
806805
if rob.CSFLEEnabled() && !IsCSFLEEnabled() {
807806
return fmt.Errorf("runOnBlock requires CSFLE to be enabled. Build with the cse tag to enable")
808-
} else if !rob.CSFLEEnabled() && IsCSFLEEnabled() {
807+
}
808+
if rob.CSFLEDisabled() && IsCSFLEEnabled() {
809809
return fmt.Errorf("runOnBlock requires CSFLE to be disabled. Build without the cse tag to disable")
810810
}
811811
if rob.CSFLEEnabled() {

internal/integration/mtest/options.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,20 @@ type RunOnBlock struct {
100100
CSFLE *CSFLE `bson:"csfleConfiguration"`
101101
}
102102

103+
// CSFLEEnabled returns true if CSFLE support is explicitly required in the
104+
// "runOnRequirement" block. It returns false if the CSFLE requirement is
105+
// unspecified or explicitly false.
103106
func (r *RunOnBlock) CSFLEEnabled() bool {
104107
return r.CSFLE != nil && (r.CSFLE.Boolean || r.CSFLE.Options != nil)
105108
}
106109

110+
// CSFLEDisabled returns true if CSFLE support is explicitly forbidden in the
111+
// "runOnRequirement" block. It returns false if the CSFLE requirement is
112+
// unspecified or explicitly true.
113+
func (r *RunOnBlock) CSFLEDisabled() bool {
114+
return r.CSFLE != nil && !r.CSFLE.Boolean
115+
}
116+
107117
// UnmarshalBSON implements custom BSON unmarshalling behavior for RunOnBlock because some test formats use the
108118
// "topology" key while the unified test format uses "topologies".
109119
func (r *RunOnBlock) UnmarshalBSON(data []byte) error {

0 commit comments

Comments
 (0)