-
Notifications
You must be signed in to change notification settings - Fork 896
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GODRIVER-2388 Improved Bulk Write API. #1884
base: master
Are you sure you want to change the base?
Changes from 2 commits
1309416
4d88edf
d10eff2
3489ac8
acca80b
fc91428
ce3ed92
4f9c841
89947bd
ecd4e1a
0a2e7b8
b43f6e6
43fb9c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -398,7 +398,7 @@ func TestClientSideEncryptionCustomCrypt(t *testing.T) { | |||||
"expected 0 calls to DecryptExplicit, got %v", cc.numDecryptExplicitCalls) | ||||||
assert.Equal(mt, cc.numCloseCalls, 0, | ||||||
"expected 0 calls to Close, got %v", cc.numCloseCalls) | ||||||
assert.Equal(mt, cc.numBypassAutoEncryptionCalls, 2, | ||||||
assert.Equal(mt, cc.numBypassAutoEncryptionCalls, 1, | ||||||
"expected 2 calls to BypassAutoEncryption, got %v", cc.numBypassAutoEncryptionCalls) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Optional: Update error message to match updated assertion.
Suggested change
|
||||||
}) | ||||||
} | ||||||
|
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -177,6 +177,60 @@ func TestCSOTProse(t *testing.T) { | |||||
"expected ping to fail within 150ms") | ||||||
}) | ||||||
}) | ||||||
|
||||||
mt.RunOpts("11. multi-batch bulkWrites", mtest.NewOptions().MinServerVersion("8.0"). | ||||||
AtlasDataLake(false).Topologies(mtest.Single), func(mt *mtest.T) { | ||||||
coll := mt.CreateCollection(mtest.Collection{DB: "db", Name: "coll"}, false) | ||||||
err := coll.Drop(context.Background()) | ||||||
require.NoError(mt, err, "Drop error: %v", err) | ||||||
|
||||||
mt.SetFailPoint(failpoint.FailPoint{ | ||||||
ConfigureFailPoint: "failCommand", | ||||||
Mode: failpoint.Mode{ | ||||||
Times: 2, | ||||||
}, | ||||||
Data: failpoint.Data{ | ||||||
FailCommands: []string{"bulkWrite"}, | ||||||
BlockConnection: true, | ||||||
BlockTimeMS: 1010, | ||||||
}, | ||||||
}) | ||||||
|
||||||
var hello struct { | ||||||
MaxBsonObjectSize int | ||||||
MaxMessageSizeBytes int | ||||||
} | ||||||
err = mt.DB.RunCommand(context.Background(), bson.D{{"hello", 1}}).Decode(&hello) | ||||||
require.NoError(mt, err, "Hello error: %v", err) | ||||||
|
||||||
models := &mongo.ClientWriteModels{} | ||||||
n := hello.MaxMessageSizeBytes/hello.MaxBsonObjectSize + 1 | ||||||
for i := 0; i < n; i++ { | ||||||
models. | ||||||
AppendInsertOne("db", "coll", &mongo.ClientInsertOneModel{ | ||||||
Document: bson.D{{"a", strings.Repeat("b", hello.MaxBsonObjectSize-500)}}, | ||||||
}) | ||||||
} | ||||||
|
||||||
var cnt int | ||||||
cm := &event.CommandMonitor{ | ||||||
Started: func(_ context.Context, evt *event.CommandStartedEvent) { | ||||||
if evt.CommandName == "bulkWrite" { | ||||||
cnt++ | ||||||
} | ||||||
}, | ||||||
} | ||||||
cliOptions := options.Client(). | ||||||
SetTimeout(2 * time.Second). | ||||||
SetMonitor(cm). | ||||||
ApplyURI(mtest.ClusterURI()) | ||||||
integtest.AddTestServerAPIVersion(cliOptions) | ||||||
cli, err := mongo.Connect(cliOptions) | ||||||
require.NoError(mt, err, "Connect error: %v", err) | ||||||
_, err = cli.BulkWrite(context.Background(), models) | ||||||
assert.ErrorContains(mt, err, "context deadline exceeded", "expected a timeout error, got: %v", err) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggest using
Suggested change
|
||||||
assert.Equal(mt, 2, cnt, "expected bulkWrite calls: %d, got: %d", 2, cnt) | ||||||
}) | ||||||
} | ||||||
|
||||||
func TestCSOTProse_GridFS(t *testing.T) { | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We only call it once after the operation.go refactoring.