Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

GODRIVER-3478 Use ExtJSON for BSON binary vector spec tests. #2003

Merged
merged 2 commits into from
Apr 11, 2025

Conversation

qingyang-hu
Copy link
Collaborator

GODRIVER-3478

Summary

Use ExtJSON for BSON binary vector spec tests.

Background & Motivation

Sync mongodb/specifications@ccd72de

@mongodb-drivers-pr-bot mongodb-drivers-pr-bot bot added the priority-3-low Low Priority PR for Review label Mar 28, 2025
Copy link
Contributor

API Change Report

No changes found!

@qingyang-hu qingyang-hu marked this pull request as ready for review March 28, 2025 21:28
@@ -82,21 +81,18 @@ func TestBsonBinaryVectorSpec(t *testing.T) {
})
}

func convertSlice[T int8 | float32 | byte](s []interface{}) []T {
func convertSlice[T int8 | float32 | byte](t *testing.T, data []byte) []T {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
func convertSlice[T int8 | float32 | byte](t *testing.T, data []byte) []T {
func convertSlice[T int8 | float32 | byte](t *testing.T, data []byte) []T {
t.Helper()

Alternatively, this method could be re-written to return an error.

Comment on lines 90 to 92
if err != nil {
t.Fatalf("got %q while handling %s", err, string(data))
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest using the require package

Suggested change
if err != nil {
t.Fatalf("got %q while handling %s", err, string(data))
}
require.NoError(t, err)

@@ -82,21 +81,18 @@ func TestBsonBinaryVectorSpec(t *testing.T) {
})
}

func convertSlice[T int8 | float32 | byte](s []interface{}) []T {
func convertSlice[T int8 | float32 | byte](t *testing.T, data []byte) []T {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this function be renamed to decodeTestSlice / unmarshalTestSlice?

@qingyang-hu qingyang-hu merged commit 2cd7f73 into mongodb:master Apr 11, 2025
30 of 34 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
priority-3-low Low Priority PR for Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants