Skip to content

Commit cb88b05

Browse files
authored
test(NODE-6834): fix flaky x509 test (#4498)
1 parent 9111f98 commit cb88b05

File tree

3 files changed

+17
-22
lines changed

3 files changed

+17
-22
lines changed

.evergreen/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1345,7 +1345,7 @@ tasks:
13451345
params:
13461346
updates:
13471347
- {key: VERSION, value: latest}
1348-
- {key: TOPOLOGY, value: sharded_cluster}
1348+
- {key: TOPOLOGY, value: server}
13491349
- {key: AUTH, value: noauth}
13501350
- {key: SSL, value: ssl}
13511351
- func: install dependencies

.evergreen/generate_evergreen_tasks.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ BASE_TASKS.push({
120120
commands: [
121121
updateExpansions({
122122
VERSION: 'latest',
123-
TOPOLOGY: 'sharded_cluster',
123+
TOPOLOGY: 'server',
124124
AUTH: 'noauth',
125125
SSL: 'ssl'
126126
}),

test/manual/x509_auth.test.ts

+15-20
Original file line numberDiff line numberDiff line change
@@ -54,22 +54,6 @@ describe('x509 Authentication', function () {
5454
});
5555
});
5656

57-
context(
58-
'when a valid cert is provided but the certificate does not correspond to a user',
59-
function () {
60-
it.skip('fails to authenticate', async function () {
61-
client = new MongoClient(connectionString.toString(), validOptions);
62-
const error = await client.connect().then(
63-
() => null,
64-
e => e
65-
);
66-
67-
expect(error).to.be.instanceOf(MongoServerError);
68-
expect(error.codeName).to.match(/UserNotFound/i);
69-
}).skipReason = 'TODO(NODE-6834): fix flaky test';
70-
}
71-
);
72-
7357
context('when the client connects with an invalid certificate', function () {
7458
// unlike other authentication mechanisms, x509 authentication 1) requires TLS and
7559
// 2) the server uses the client certificate to derive a username to authenticate with
@@ -93,6 +77,19 @@ describe('x509 Authentication', function () {
9377
expect(error).to.be.instanceOf(MongoServerSelectionError);
9478
});
9579
});
80+
81+
context(
82+
'when a valid cert is provided but the certificate does not correspond to a user',
83+
function () {
84+
it('fails to authenticate', async function () {
85+
client = new MongoClient(connectionString.toString(), validOptions);
86+
const error = await client.connect().catch(error => error);
87+
88+
expect(error).to.be.instanceOf(MongoServerError);
89+
expect(error.codeName).to.match(/UserNotFound/i);
90+
});
91+
}
92+
);
9693
});
9794

9895
async function createX509User() {
@@ -110,8 +107,7 @@ async function createX509User() {
110107
roles: [
111108
{ role: 'readWrite', db: 'test' },
112109
{ role: 'userAdminAnyDatabase', db: 'admin' }
113-
],
114-
writeConcern: { w: 'majority', wtimeout: 5000 }
110+
]
115111
});
116112
} finally {
117113
await utilClient.close();
@@ -128,8 +124,7 @@ async function dropX509User() {
128124
try {
129125
await utilClient.connect();
130126
await utilClient.db('$external').command({
131-
dropUser: process.env.SUBJECT,
132-
writeConcern: { w: 'majority', wtimeout: 5000 }
127+
dropUser: process.env.SUBJECT
133128
});
134129
} finally {
135130
await utilClient.close();

0 commit comments

Comments
 (0)