Skip to content

Commit e1b4a9e

Browse files
lint changes
1 parent 26a85b7 commit e1b4a9e

File tree

6 files changed

+48
-42
lines changed

6 files changed

+48
-42
lines changed

test/integration/client-side-encryption/client_side_encryption.prose.12.deadlock.test.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import * as path from 'path';
55

66
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
77
import { ClientEncryption } from '../../../src/client-side-encryption/client_encryption';
8-
import { type CommandStartedEvent, MongoClient, type MongoClientOptions } from '../../mongodb';
8+
import { type CommandStartedEvent, type MongoClient, type MongoClientOptions } from '../../mongodb';
9+
import { type TestConfiguration } from '../../tools/runner/config';
910
import { dropCollection } from '../shared';
10-
import { TestConfiguration } from '../../tools/runner/config';
1111

1212
/* REFERENCE: (note commit hash) */
1313
/* https://github.com/mongodb/specifications/blob/b3beada 72ae1c992294ae6a8eea572003a274c35/source/client-side-encryption/tests/README.rst#deadlock-tests */
@@ -30,10 +30,12 @@ const $jsonSchema = BSON.EJSON.parse(
3030
)
3131
);
3232

33-
function makeClient(configuration: TestConfiguration, options: MongoClientOptions = {}): MongoClient &
34-
{
35-
commandStartedEvents: Array<CommandStartedEvent>,
36-
clientsCreated: number
33+
function makeClient(
34+
configuration: TestConfiguration,
35+
options: MongoClientOptions = {}
36+
): MongoClient & {
37+
commandStartedEvents: Array<CommandStartedEvent>;
38+
clientsCreated: number;
3739
} {
3840
options = { ...options, monitorCommands: true, __skipPingOnConnect: true };
3941
if (process.env.MONGODB_API_VERSION) {
@@ -104,12 +106,13 @@ const metadata: MongoDBMetadataUI = {
104106
topology: '!load-balanced'
105107
}
106108
};
107-
describe.only('Connection Pool Deadlock Prevention', function () {
109+
110+
describe('Connection Pool Deadlock Prevention', function () {
108111
beforeEach(async function () {
109112
this.clientTest = makeClient(this.configuration);
110113
this.clientKeyVault = makeClient(this.configuration, {
111114
monitorCommands: true,
112-
maxPoolSize: 1,
115+
maxPoolSize: 1
113116
});
114117

115118
this.clientEncryption = undefined;
@@ -132,7 +135,7 @@ describe.only('Connection Pool Deadlock Prevention', function () {
132135
this.clientEncryption = new ClientEncryption(this.clientTest, {
133136
kmsProviders: { local: { key: LOCAL_KEY } },
134137
keyVaultNamespace: 'keyvault.datakeys',
135-
keyVaultClient: this.keyVaultClient,
138+
keyVaultClient: this.keyVaultClient
136139
});
137140

138141
this.ciphertext = await this.clientEncryption.encrypt('string0', {

test/integration/client-side-encryption/client_side_encryption.prose.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const getKmsProviders = (localKey, kmipEndpoint, azureEndpoint, gcpEndpoint) =>
4242
return result;
4343
};
4444

45-
const noop = () => { };
45+
const noop = () => {};
4646
const metadata = {
4747
requires: {
4848
clientSideEncryption: true,
@@ -1355,7 +1355,7 @@ describe('Client Side Encryption Prose Tests', metadata, function () {
13551355

13561356
// TODO(NODE-3151): Implement kms prose tests
13571357
describe('KMS TLS Tests', () => {
1358-
it.skip('TBD', () => { }).skipReason = 'TODO(NODE-3151): Implement "KMS TLS Tests"';
1358+
it.skip('TBD', () => {}).skipReason = 'TODO(NODE-3151): Implement "KMS TLS Tests"';
13591359
});
13601360

13611361
/**
@@ -1696,7 +1696,7 @@ describe('Client Side Encryption Prose Tests', metadata, function () {
16961696
context(
16971697
'Case 5: `tlsDisableOCSPEndpointCheck` is permitted',
16981698
metadata,
1699-
function () { }
1699+
function () {}
17001700
).skipReason = 'TODO(NODE-4840): Node does not support any OCSP options';
17011701

17021702
context('Case 6: named KMS providers apply TLS options', function () {

test/tools/runner/config.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,11 @@ export class TestConfiguration {
116116
replicaSet: url.searchParams.get('replicaSet'),
117117
proxyURIParams: url.searchParams.get('proxyHost')
118118
? {
119-
proxyHost: url.searchParams.get('proxyHost'),
120-
proxyPort: Number(url.searchParams.get('proxyPort')),
121-
proxyUsername: url.searchParams.get('proxyUsername'),
122-
proxyPassword: url.searchParams.get('proxyPassword')
123-
}
119+
proxyHost: url.searchParams.get('proxyHost'),
120+
proxyPort: Number(url.searchParams.get('proxyPort')),
121+
proxyUsername: url.searchParams.get('proxyUsername'),
122+
proxyPassword: url.searchParams.get('proxyPassword')
123+
}
124124
: undefined
125125
};
126126
if (url.username) {
@@ -455,18 +455,21 @@ export class AstrolabeTestConfiguration extends TestConfiguration {
455455
}
456456

457457
export class AlpineTestConfiguration extends TestConfiguration {
458-
override newClient(urlOrQueryOptions?: string | Record<string, any>, serverOptions?: MongoClientOptions): MongoClient {
458+
override newClient(
459+
urlOrQueryOptions?: string | Record<string, any>,
460+
serverOptions?: MongoClientOptions
461+
): MongoClient {
459462
const options = serverOptions ?? {};
460463

461464
if (options.autoEncryption) {
462465
const extraOptions: MongoClientOptions['autoEncryption']['extraOptions'] = {
463466
...options.autoEncryption.extraOptions,
464467
mongocryptdBypassSpawn: true,
465468
mongocryptdURI: process.env.MONGOCRYPTD_URI
466-
}
469+
};
467470
options.autoEncryption.extraOptions = extraOptions;
468471
}
469472

470473
return super.newClient(urlOrQueryOptions, options);
471474
}
472-
}
475+
}

test/tools/runner/hooks/configuration.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,10 @@ const testConfigBeforeHook = async function () {
153153
.command({ getParameter: '*' })
154154
.catch(error => ({ noReply: error }));
155155

156-
const Config: typeof TestConfiguration = process.env.ALPINE ? AlpineTestConfiguration : TestConfiguration;
157-
this.configuration = new Config(
158-
loadBalanced ? SINGLE_MONGOS_LB_URI : MONGODB_URI,
159-
context
160-
);
156+
const Config: typeof TestConfiguration = process.env.ALPINE
157+
? AlpineTestConfiguration
158+
: TestConfiguration;
159+
this.configuration = new Config(loadBalanced ? SINGLE_MONGOS_LB_URI : MONGODB_URI, context);
161160

162161
await client.close();
163162

test/tools/spec-runner/context.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ class TestRunnerContext {
9595
? `${extractAuthFromConnectionString(process.env.MONGODB_URI)}@`
9696
: '';
9797
return config.newClient(
98-
`mongodb://${authString}${proxy.host}:${proxy.port}/${process.env.AUTH === 'auth' ? '?authSource=admin' : ''
98+
`mongodb://${authString}${proxy.host}:${proxy.port}/${
99+
process.env.AUTH === 'auth' ? '?authSource=admin' : ''
99100
}`
100101
);
101102
});
@@ -247,8 +248,8 @@ function findMatchingEvents(context, eventName) {
247248
const allEvents = context.sdamEvents.concat(context.cmapEvents);
248249
return eventName === 'ServerMarkedUnknownEvent'
249250
? context.sdamEvents
250-
.filter(event => event.constructor.name === 'ServerDescriptionChangedEvent')
251-
.filter(event => event.newDescription.type === 'Unknown')
251+
.filter(event => event.constructor.name === 'ServerDescriptionChangedEvent')
252+
.filter(event => event.newDescription.type === 'Unknown')
252253
: allEvents.filter(event => event.constructor.name.match(new RegExp(eventName)));
253254
}
254255

test/tools/spec-runner/index.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -263,19 +263,19 @@ function prepareDatabaseForSuite(suite, context) {
263263
const setupPromise = context.serverless
264264
? Promise.resolve()
265265
: db
266-
.admin()
267-
.command({ killAllSessions: [] })
268-
.catch(err => {
269-
if (
270-
err.message.match(/no such (cmd|command)/) ||
271-
err.message.match(/Failed to kill on some hosts/) ||
272-
err.code === 11601
273-
) {
274-
return;
275-
}
266+
.admin()
267+
.command({ killAllSessions: [] })
268+
.catch(err => {
269+
if (
270+
err.message.match(/no such (cmd|command)/) ||
271+
err.message.match(/Failed to kill on some hosts/) ||
272+
err.code === 11601
273+
) {
274+
return;
275+
}
276276

277-
throw err;
278-
});
277+
throw err;
278+
});
279279

280280
if (context.collectionName == null || context.dbName === 'admin') {
281281
return setupPromise;
@@ -334,7 +334,7 @@ function prepareDatabaseForSuite(suite, context) {
334334
.db(context.dbName)
335335
.collection(context.collectionName)
336336
.distinct('x')
337-
.catch(() => { });
337+
.catch(() => {});
338338
});
339339
});
340340
}
@@ -914,7 +914,7 @@ function testOperation(operation, obj, context, options) {
914914
() => {
915915
throw new Error('expected an error!');
916916
},
917-
() => { }
917+
() => {}
918918
);
919919
}
920920

0 commit comments

Comments
 (0)