Skip to content

Commit 4b107a1

Browse files
committed
Update Client BulkWrite prose tests
1 parent 2733c2d commit 4b107a1

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

internal/integration/crud_prose_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -903,6 +903,10 @@ func TestClientBulkWriteProse(t *testing.T) {
903903
}}
904904
_, err := mt.Client.BulkWrite(context.Background(), writes)
905905
require.EqualError(mt, err, driver.ErrDocumentTooLarge.Error())
906+
var cbwe mongo.ClientBulkWriteException
907+
if errors.As(err, &cbwe) {
908+
assert.Nil(mt, cbwe.PartialResult, "expected nil PartialResult in ClientBulkWriteException")
909+
}
906910
})
907911
mt.Run("Case 2: namespace too large", func(mt *mtest.T) {
908912
writes := []mongo.ClientBulkWrite{{
@@ -914,6 +918,10 @@ func TestClientBulkWriteProse(t *testing.T) {
914918
}}
915919
_, err := mt.Client.BulkWrite(context.Background(), writes)
916920
require.EqualError(mt, err, driver.ErrDocumentTooLarge.Error())
921+
var cbwe mongo.ClientBulkWriteException
922+
if errors.As(err, &cbwe) {
923+
assert.Nil(mt, cbwe.PartialResult, "expected nil PartialResult in ClientBulkWriteException")
924+
}
917925
})
918926
})
919927

@@ -943,6 +951,10 @@ func TestClientBulkWriteProse(t *testing.T) {
943951
}}
944952
_, err := mt.Client.BulkWrite(context.Background(), writes)
945953
require.ErrorContains(mt, err, "bulkWrite does not currently support automatic encryption")
954+
var cbwe mongo.ClientBulkWriteException
955+
if errors.As(err, &cbwe) {
956+
assert.Nil(mt, cbwe.PartialResult, "expected nil PartialResult in ClientBulkWriteException")
957+
}
946958
})
947959

948960
mt.Run("15. MongoClient.bulkWrite with unacknowledged write concern uses w:0 for all batches", func(mt *mtest.T) {

0 commit comments

Comments
 (0)