Skip to content

Commit 0342d92

Browse files
temp2
1 parent f3b47c0 commit 0342d92

File tree

5 files changed

+20
-25
lines changed

5 files changed

+20
-25
lines changed

src/cmap/connection.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ export interface CommandOptions extends BSONSerializeOptions {
9393
writeConcern?: WriteConcern;
9494

9595
directConnection?: boolean;
96+
97+
// Triggers fire-and-forget protocol for commands that don't support WriteConcern
98+
moreToCome?: boolean;
9699
}
97100

98101
/** @public */

test/integration/connection-monitoring-and-pooling/connection.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,21 @@ describe('Connection', function () {
144144
}
145145
}
146146
});
147+
148+
it('supports fire-and-forget messages', async function () {
149+
const options: ConnectionOptions = {
150+
...commonConnectOptions,
151+
connectionType: Connection,
152+
...this.configuration.options,
153+
metadata: makeClientMetadata({ driverInfo: {} }),
154+
extendedMetadata: addContainerMetadata(makeClientMetadata({ driverInfo: {} }))
155+
};
156+
157+
const conn = await connect(options);
158+
const readSpy = sinon.spy(conn, 'readMany');
159+
await conn.command(ns('$admin.cmd'), { ping: 1 }, { moreToCome: true });
160+
expect(readSpy).to.not.have.been.called;
161+
});
147162
});
148163

149164
describe('Connection - functional', function () {

test/integration/read-write-concern/write_concern.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ describe('Write Concern', function () {
173173
});
174174
});
175175

176-
describe.only('fire-and-forget protocol', function () {
176+
describe('fire-and-forget protocol', function () {
177177
context('when writeConcern = 0 and OP_MSG is used', function () {
178178
const writeOperations: { name: string; command: any; expectedReturnVal: any }[] = [
179179
{

test/unit/cmap/connection.test.ts

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -28,29 +28,6 @@ describe('new Connection()', function () {
2828

2929
before(() => mock.createServer().then(s => (server = s)));
3030

31-
it.only('supports fire-and-forget messages', async function () {
32-
server.setMessageHandler(request => {
33-
const doc = request.document;
34-
if (isHello(doc)) {
35-
request.reply(mock.HELLO);
36-
}
37-
38-
// black hole all other requests
39-
});
40-
41-
const options = {
42-
...connectionOptionsDefaults,
43-
connectionType: Connection,
44-
hostAddress: server.hostAddress(),
45-
authProviders: new MongoClientAuthProviders()
46-
};
47-
48-
const conn = await connect(options);
49-
const readSpy = sinon.spy(conn, 'readMany');
50-
await conn.command(ns('$admin.cmd'), { ping: 1 }, { moreToCome: true });
51-
expect(readSpy).to.not.have.been.called;
52-
});
53-
5431
it('destroys streams which time out', async function () {
5532
server.setMessageHandler(request => {
5633
const doc = request.document;

test/unit/collection.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe('Collection', function () {
1515
});
1616

1717
context('#createIndex', () => {
18-
it.only('should error when createIndex fails', function (done) {
18+
it('should error when createIndex fails', function (done) {
1919
const ERROR_RESPONSE = {
2020
ok: 0,
2121
errmsg:

0 commit comments

Comments
 (0)