Skip to content

Commit b4b479a

Browse files
authored
Merge branch 'master' into godriver3591-fix-compilecheck-ver
2 parents 6c28ff6 + ff50112 commit b4b479a

File tree

4 files changed

+26
-14
lines changed

4 files changed

+26
-14
lines changed

.github/workflows/scorecard.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
persist-credentials: false
4040

4141
- name: "Run analysis"
42-
uses: ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b75731b0186 # v2.4.1
42+
uses: ossf/scorecard-action@05b42c624433fc40578a4040d5cf5e36ddca8cde # v2.4.2
4343
with:
4444
results_file: results.sarif
4545
results_format: sarif
@@ -64,7 +64,7 @@ jobs:
6464
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
6565
# format to the repository Actions tab.
6666
- name: "Upload artifact"
67-
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
67+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
6868
with:
6969
name: SARIF file
7070
path: results.sarif

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
<a href="https://pkg.go.dev/go.mongodb.org/mongo-driver/v2/mongo"><img src="etc/assets/godev-mongo-blue.svg" alt="docs"></a>
55
<a href="https://pkg.go.dev/go.mongodb.org/mongo-driver/v2/bson"><img src="etc/assets/godev-bson-blue.svg" alt="docs"></a>
66
<a href="https://www.mongodb.com/docs/drivers/go/current/"><img src="etc/assets/docs-mongodb-green.svg"></a>
7+
<a href="https://securityscorecards.dev/viewer/?uri=github.com/mongodb/mongo-go-driver">
8+
<img src="https://api.securityscorecards.dev/projects/github.com/mongodb/mongo-go-driver/badge" alt="OpenSSF Scorecard" />
9+
</a>
710
</p>
811

912
# MongoDB Go Driver

internal/integration/unified/matches.go

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -242,19 +242,32 @@ func evaluateSpecialComparison(ctx context.Context, assertionDoc bson.Raw, actua
242242
return fmt.Errorf("expected lsid %v, got %v", expectedID, actualID)
243243
}
244244
case "$$lte":
245-
if assertionVal.Type != bson.TypeInt32 && assertionVal.Type != bson.TypeInt64 {
246-
return fmt.Errorf("expected assertionVal to be an Int32 or Int64 but got a %s", assertionVal.Type)
245+
if assertionVal.Type != bson.TypeInt32 && assertionVal.Type != bson.TypeInt64 && assertionVal.Type != bson.TypeDouble {
246+
return fmt.Errorf("expected assertionVal to be an Int32, Int64, or Double but got a %s", assertionVal.Type)
247247
}
248-
if actual.Type != bson.TypeInt32 && actual.Type != bson.TypeInt64 {
249-
return fmt.Errorf("expected value to be an Int32 or Int64 but got a %s", actual.Type)
248+
if actual.Type != bson.TypeInt32 && actual.Type != bson.TypeInt64 && assertionVal.Type != bson.TypeDouble {
249+
return fmt.Errorf("expected value to be an Int32, Int64, or Double but got a %s", actual.Type)
250250
}
251251

252252
// Numeric values can be compared even if their types are different (e.g. if expected is an int32 and actual
253253
// is an int64).
254-
expectedInt64 := assertionVal.AsInt64()
255-
actualInt64 := actual.AsInt64()
256-
if actualInt64 > expectedInt64 {
257-
return fmt.Errorf("expected numeric value %d to be less than or equal %d", actualInt64, expectedInt64)
254+
255+
// TODO(GODRIVER-3594): If we decide to add AsDoubleOK() as a method to RawValue, this following conversion should be updated.
256+
var expectedF64 float64
257+
if assertionVal.Type == bson.TypeDouble {
258+
expectedF64 = assertionVal.Double()
259+
} else {
260+
expectedF64 = float64(assertionVal.AsInt64())
261+
}
262+
var actualF64 float64
263+
if actual.Type == bson.TypeDouble {
264+
actualF64 = actual.Double()
265+
} else {
266+
actualF64 = float64(actual.AsInt64())
267+
}
268+
269+
if actualF64 > expectedF64 {
270+
return fmt.Errorf("expected numeric value %f to be less than or equal %f", actualF64, expectedF64)
258271
}
259272
return nil
260273
case "$$matchAsDocument":

internal/spectest/skip.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ import "testing"
1111
// skipTests is a map of "fully-qualified test name" to "the reason for skipping
1212
// the test".
1313
var skipTests = map[string][]string{
14-
// TODO(GODRIVER-3518): Test flexible numeric comparisons with $$lte
15-
"Modifies $$lte operator test to also use floating point and Int64 types (GODRIVER-3518)": {
16-
"TestUnifiedSpec/unified-test-format/tests/valid-pass/operator-lte.json/special_lte_matching_operator",
17-
},
1814

1915
// SPEC-1403: This test checks to see if the correct error is thrown when auto
2016
// encrypting with a server < 4.2. Currently, the test will fail because a

0 commit comments

Comments
 (0)