From 926b83cd01d47d716136e5fa7713bde235a05439 Mon Sep 17 00:00:00 2001 From: Preston Vasquez Date: Tue, 30 Apr 2024 15:46:28 -0600 Subject: [PATCH] GODRIVER-2443 Fix type and add want sanity check --- internal/integration/collection_test.go | 2 +- internal/integration/crud_helpers_test.go | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/internal/integration/collection_test.go b/internal/integration/collection_test.go index 4900de06c3..c98441b9d2 100644 --- a/internal/integration/collection_test.go +++ b/internal/integration/collection_test.go @@ -896,7 +896,7 @@ func TestCollection(t *testing.T) { err := res.Decode(&got) assert.NoError(t, err) - assert.EqualValues(mt, tc.want, got, "expected result %v, got %v", tc.want, res) + assert.EqualValues(mt, tc.want, got, "expected result %v, got %v", tc.want, got) }) } }) diff --git a/internal/integration/crud_helpers_test.go b/internal/integration/crud_helpers_test.go index aa137e0cfc..973370c1a1 100644 --- a/internal/integration/crud_helpers_test.go +++ b/internal/integration/crud_helpers_test.go @@ -1546,7 +1546,12 @@ func verifyDistinctResult( return } - for i, iwant := range want.(bson.A) { + assert.NotNil(mt, want, "expected want to be non-nil") + + arr, ok := want.(bson.A) + assert.True(mt, ok, "expected want to be a BSON array") + + for i, iwant := range arr { gotRawValue := got.Index(uint(i)) iwantType, iwantBytes, err := bson.MarshalValue(iwant)