Skip to content

Commit ad151f7

Browse files
temp commit
1 parent 73ca011 commit ad151f7

File tree

4 files changed

+95
-41
lines changed

4 files changed

+95
-41
lines changed

test/integration/change-streams/change_stream.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { strict as assert } from 'assert';
22
import { expect } from 'chai';
3+
import * as dns from 'dns';
34
import { on, once } from 'events';
45
import { gte, lt } from 'semver';
56
import * as sinon from 'sinon';

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

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { once } from 'node:events';
33
import { expect } from 'chai';
44

55
import { type ConnectionPoolCreatedEvent, type Db, type MongoClient } from '../../mongodb';
6+
import sinon = require('sinon');
7+
import dns = require('dns');
68

79
describe('Connection Pool', function () {
810
let client: MongoClient;
@@ -19,6 +21,52 @@ describe('Connection Pool', function () {
1921

2022
describe('Events', function () {
2123
describe('ConnectionPoolCreatedEvent', function () {
24+
describe.only(
25+
'Initial DNS Seedlist Discovery (Prose Tests)',
26+
{ requires: { topology: 'single' } },
27+
() => {
28+
function makeSrvStub() {
29+
sinon.stub(dns.promises, 'resolveSrv').callsFake(async () => {
30+
return [
31+
{
32+
name: 'localhost',
33+
port: 27017,
34+
weight: 0,
35+
priority: 0
36+
}
37+
];
38+
});
39+
40+
sinon.stub(dns.promises, 'resolveTxt').callsFake(async () => {
41+
throw { code: 'ENODATA' };
42+
});
43+
}
44+
45+
afterEach(async function () {
46+
sinon.restore();
47+
});
48+
49+
it('1.1 Driver should not throw error on valid SRV URI with one part', async function () {
50+
// 1. make dns resolution always pass
51+
makeSrvStub();
52+
// 2. assert that creating a MongoClient with the uri 'mongodb+srv:/localhost' does not cause an error
53+
client = this.configuration.newClient('mongodb+srv://localhost', {});
54+
console.log('stubbed srv client', client);
55+
// 3. assert that connecting the client from 2. to the server does not cause an error
56+
//await client.connect();
57+
});
58+
59+
it('1.1 Driver should not throw error on valid SRV URI with two parts', async function () {
60+
// 1. make dns resolution always pass
61+
makeSrvStub();
62+
// 2. assert that creating a MongoClient with the uri 'mongodb+srv://mongodb.localhost' does not cause an error
63+
const client = this.configuration.newClient('mongodb://localhost', {});
64+
console.log('stubbed normal client', client);
65+
// 3. assert that connecting the client to the server does not cause an error
66+
//await client.connect();
67+
});
68+
}
69+
);
2270
context('when no connection pool options are passed in', function () {
2371
let pConnectionPoolCreated: Promise<ConnectionPoolCreatedEvent[]>;
2472
let connectionPoolCreated: ConnectionPoolCreatedEvent;

test/integration/crud/bulk.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ describe('Bulk', function () {
723723
}
724724
});
725725

726-
it(
726+
it.only(
727727
'should correctly execute ordered batch using w:0',
728728
// TODO(NODE-6060): set `moreToCome` op_msg bit when `w: 0` is specified
729729
{ requires: { mongodb: '<8.0.0' } },
Lines changed: 45 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,52 @@
1-
import { expect } from 'chai';
21
import * as dns from 'dns';
3-
4-
import { MongoClient } from '../../mongodb';
52
import sinon = require('sinon');
3+
// import { expect } from 'chai';
64

7-
describe.only('Initial DNS Seedlist Discovery (Prose Tests)', () => {
8-
function makeSrvStub() {
9-
sinon.stub(dns.promises, 'resolveSrv').callsFake(async () => {
10-
return [
11-
{
12-
name: 'localhost',
13-
port: 27017,
14-
weight: 0,
15-
priority: 0
16-
}
17-
];
18-
});
5+
import { type MongoClient } from '../../mongodb';
196

20-
sinon.stub(dns.promises, 'resolveTxt').callsFake(async () => {
21-
throw { code: 'ENODATA' };
22-
});
23-
}
7+
describe(
8+
'Initial DNS Seedlist Discovery (Prose Tests)',
9+
{ requires: { topology: 'single' } },
10+
() => {
11+
let client: MongoClient;
12+
13+
function makeSrvStub() {
14+
sinon.stub(dns.promises, 'resolveSrv').callsFake(async () => {
15+
return [
16+
{
17+
name: 'localhost',
18+
port: 27017,
19+
weight: 0,
20+
priority: 0
21+
}
22+
];
23+
});
2424

25-
afterEach(async () => {
26-
sinon.restore();
27-
});
25+
sinon.stub(dns.promises, 'resolveTxt').callsFake(async () => {
26+
throw { code: 'ENODATA' };
27+
});
28+
}
2829

29-
it('1.1 Driver should not throw error on SRV URI with two parts', async () => {
30-
// 1. stub dns resolution to always pass
31-
makeSrvStub();
32-
// 2. assert that creating a MongoClient with the uri 'mongodb+srv://mongodb.localhost' does not cause an error
33-
//const client = new MongoClient('mongodb+srv://mongodb.localhost', {});
34-
const client = new MongoClient('mongodb+srv://mongodb.localhost');
35-
// 3. assert that connecting the client from 2. to the server does not cause an error
36-
await client.connect();
37-
});
30+
afterEach(async function () {
31+
sinon.restore();
32+
});
33+
34+
it('1.1 Driver should not throw error on valid SRV URI with one part', async function () {
35+
// 1. make dns resolution always pass
36+
//makeSrvStub();
37+
// 2. assert that creating a MongoClient with the uri 'mongodb+srv:/localhost' does not cause an error
38+
client = this.configuration.newClient('mongodb://localhost', {});
39+
// 3. assert that connecting the client from 2. to the server does not cause an error
40+
await client.connect();
41+
});
3842

39-
it('1.2 Driver should not throw error on SRV URI with one part', async () => {
40-
// 1. stub dns resolution to always pass
41-
makeSrvStub();
42-
// 2. assert that creating a MongoClient with the uri 'mongodb+srv//localhost' does not cause an error
43-
const client = new MongoClient('mongodb+srv://localhost', {});
44-
// 3. assert that connecting the client from 2. to the server does not cause an error
45-
await client.connect();
46-
});
47-
});
43+
it('1.1 Driver should not throw error on valid SRV URI with two parts', async function () {
44+
// 1. make dns resolution always pass
45+
makeSrvStub();
46+
// 2. assert that creating a MongoClient with the uri 'mongodb+srv://mongodb.localhost' does not cause an error
47+
//const client = new MongoClient('mongodb+srv://mongodb.localhost', {});
48+
// 3. assert that connecting the client to the server does not cause an error
49+
//await client.connect();
50+
});
51+
}
52+
);

0 commit comments

Comments
 (0)