From e1b4a9ef4a4464f912159ea923551aa4b243fef1 Mon Sep 17 00:00:00 2001 From: bailey Date: Thu, 13 Feb 2025 10:59:13 -0700 Subject: [PATCH] lint changes --- ..._side_encryption.prose.12.deadlock.test.ts | 21 ++++++++------ .../client_side_encryption.prose.test.js | 6 ++-- test/tools/runner/config.ts | 19 +++++++------ test/tools/runner/hooks/configuration.ts | 9 +++--- test/tools/spec-runner/context.js | 7 +++-- test/tools/spec-runner/index.js | 28 +++++++++---------- 6 files changed, 48 insertions(+), 42 deletions(-) diff --git a/test/integration/client-side-encryption/client_side_encryption.prose.12.deadlock.test.ts b/test/integration/client-side-encryption/client_side_encryption.prose.12.deadlock.test.ts index 1002eb0f7d4..ae54b0f306c 100644 --- a/test/integration/client-side-encryption/client_side_encryption.prose.12.deadlock.test.ts +++ b/test/integration/client-side-encryption/client_side_encryption.prose.12.deadlock.test.ts @@ -5,9 +5,9 @@ import * as path from 'path'; // eslint-disable-next-line @typescript-eslint/no-restricted-imports import { ClientEncryption } from '../../../src/client-side-encryption/client_encryption'; -import { type CommandStartedEvent, MongoClient, type MongoClientOptions } from '../../mongodb'; +import { type CommandStartedEvent, type MongoClient, type MongoClientOptions } from '../../mongodb'; +import { type TestConfiguration } from '../../tools/runner/config'; import { dropCollection } from '../shared'; -import { TestConfiguration } from '../../tools/runner/config'; /* REFERENCE: (note commit hash) */ /* 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( ) ); -function makeClient(configuration: TestConfiguration, options: MongoClientOptions = {}): MongoClient & -{ - commandStartedEvents: Array, - clientsCreated: number +function makeClient( + configuration: TestConfiguration, + options: MongoClientOptions = {} +): MongoClient & { + commandStartedEvents: Array; + clientsCreated: number; } { options = { ...options, monitorCommands: true, __skipPingOnConnect: true }; if (process.env.MONGODB_API_VERSION) { @@ -104,12 +106,13 @@ const metadata: MongoDBMetadataUI = { topology: '!load-balanced' } }; -describe.only('Connection Pool Deadlock Prevention', function () { + +describe('Connection Pool Deadlock Prevention', function () { beforeEach(async function () { this.clientTest = makeClient(this.configuration); this.clientKeyVault = makeClient(this.configuration, { monitorCommands: true, - maxPoolSize: 1, + maxPoolSize: 1 }); this.clientEncryption = undefined; @@ -132,7 +135,7 @@ describe.only('Connection Pool Deadlock Prevention', function () { this.clientEncryption = new ClientEncryption(this.clientTest, { kmsProviders: { local: { key: LOCAL_KEY } }, keyVaultNamespace: 'keyvault.datakeys', - keyVaultClient: this.keyVaultClient, + keyVaultClient: this.keyVaultClient }); this.ciphertext = await this.clientEncryption.encrypt('string0', { diff --git a/test/integration/client-side-encryption/client_side_encryption.prose.test.js b/test/integration/client-side-encryption/client_side_encryption.prose.test.js index 4547f8c1b4d..7367c054f79 100644 --- a/test/integration/client-side-encryption/client_side_encryption.prose.test.js +++ b/test/integration/client-side-encryption/client_side_encryption.prose.test.js @@ -42,7 +42,7 @@ const getKmsProviders = (localKey, kmipEndpoint, azureEndpoint, gcpEndpoint) => return result; }; -const noop = () => { }; +const noop = () => {}; const metadata = { requires: { clientSideEncryption: true, @@ -1355,7 +1355,7 @@ describe('Client Side Encryption Prose Tests', metadata, function () { // TODO(NODE-3151): Implement kms prose tests describe('KMS TLS Tests', () => { - it.skip('TBD', () => { }).skipReason = 'TODO(NODE-3151): Implement "KMS TLS Tests"'; + it.skip('TBD', () => {}).skipReason = 'TODO(NODE-3151): Implement "KMS TLS Tests"'; }); /** @@ -1696,7 +1696,7 @@ describe('Client Side Encryption Prose Tests', metadata, function () { context( 'Case 5: `tlsDisableOCSPEndpointCheck` is permitted', metadata, - function () { } + function () {} ).skipReason = 'TODO(NODE-4840): Node does not support any OCSP options'; context('Case 6: named KMS providers apply TLS options', function () { diff --git a/test/tools/runner/config.ts b/test/tools/runner/config.ts index f1b928c3eb9..96d1f677a66 100644 --- a/test/tools/runner/config.ts +++ b/test/tools/runner/config.ts @@ -116,11 +116,11 @@ export class TestConfiguration { replicaSet: url.searchParams.get('replicaSet'), proxyURIParams: url.searchParams.get('proxyHost') ? { - proxyHost: url.searchParams.get('proxyHost'), - proxyPort: Number(url.searchParams.get('proxyPort')), - proxyUsername: url.searchParams.get('proxyUsername'), - proxyPassword: url.searchParams.get('proxyPassword') - } + proxyHost: url.searchParams.get('proxyHost'), + proxyPort: Number(url.searchParams.get('proxyPort')), + proxyUsername: url.searchParams.get('proxyUsername'), + proxyPassword: url.searchParams.get('proxyPassword') + } : undefined }; if (url.username) { @@ -455,7 +455,10 @@ export class AstrolabeTestConfiguration extends TestConfiguration { } export class AlpineTestConfiguration extends TestConfiguration { - override newClient(urlOrQueryOptions?: string | Record, serverOptions?: MongoClientOptions): MongoClient { + override newClient( + urlOrQueryOptions?: string | Record, + serverOptions?: MongoClientOptions + ): MongoClient { const options = serverOptions ?? {}; if (options.autoEncryption) { @@ -463,10 +466,10 @@ export class AlpineTestConfiguration extends TestConfiguration { ...options.autoEncryption.extraOptions, mongocryptdBypassSpawn: true, mongocryptdURI: process.env.MONGOCRYPTD_URI - } + }; options.autoEncryption.extraOptions = extraOptions; } return super.newClient(urlOrQueryOptions, options); } -} \ No newline at end of file +} diff --git a/test/tools/runner/hooks/configuration.ts b/test/tools/runner/hooks/configuration.ts index 757213184f3..1af5e7a6ee6 100644 --- a/test/tools/runner/hooks/configuration.ts +++ b/test/tools/runner/hooks/configuration.ts @@ -153,11 +153,10 @@ const testConfigBeforeHook = async function () { .command({ getParameter: '*' }) .catch(error => ({ noReply: error })); - const Config: typeof TestConfiguration = process.env.ALPINE ? AlpineTestConfiguration : TestConfiguration; - this.configuration = new Config( - loadBalanced ? SINGLE_MONGOS_LB_URI : MONGODB_URI, - context - ); + const Config: typeof TestConfiguration = process.env.ALPINE + ? AlpineTestConfiguration + : TestConfiguration; + this.configuration = new Config(loadBalanced ? SINGLE_MONGOS_LB_URI : MONGODB_URI, context); await client.close(); diff --git a/test/tools/spec-runner/context.js b/test/tools/spec-runner/context.js index 50831d53bf2..7a678194b55 100644 --- a/test/tools/spec-runner/context.js +++ b/test/tools/spec-runner/context.js @@ -95,7 +95,8 @@ class TestRunnerContext { ? `${extractAuthFromConnectionString(process.env.MONGODB_URI)}@` : ''; return config.newClient( - `mongodb://${authString}${proxy.host}:${proxy.port}/${process.env.AUTH === 'auth' ? '?authSource=admin' : '' + `mongodb://${authString}${proxy.host}:${proxy.port}/${ + process.env.AUTH === 'auth' ? '?authSource=admin' : '' }` ); }); @@ -247,8 +248,8 @@ function findMatchingEvents(context, eventName) { const allEvents = context.sdamEvents.concat(context.cmapEvents); return eventName === 'ServerMarkedUnknownEvent' ? context.sdamEvents - .filter(event => event.constructor.name === 'ServerDescriptionChangedEvent') - .filter(event => event.newDescription.type === 'Unknown') + .filter(event => event.constructor.name === 'ServerDescriptionChangedEvent') + .filter(event => event.newDescription.type === 'Unknown') : allEvents.filter(event => event.constructor.name.match(new RegExp(eventName))); } diff --git a/test/tools/spec-runner/index.js b/test/tools/spec-runner/index.js index 603d0a2475c..acd3896ef7c 100644 --- a/test/tools/spec-runner/index.js +++ b/test/tools/spec-runner/index.js @@ -263,19 +263,19 @@ function prepareDatabaseForSuite(suite, context) { const setupPromise = context.serverless ? Promise.resolve() : db - .admin() - .command({ killAllSessions: [] }) - .catch(err => { - if ( - err.message.match(/no such (cmd|command)/) || - err.message.match(/Failed to kill on some hosts/) || - err.code === 11601 - ) { - return; - } + .admin() + .command({ killAllSessions: [] }) + .catch(err => { + if ( + err.message.match(/no such (cmd|command)/) || + err.message.match(/Failed to kill on some hosts/) || + err.code === 11601 + ) { + return; + } - throw err; - }); + throw err; + }); if (context.collectionName == null || context.dbName === 'admin') { return setupPromise; @@ -334,7 +334,7 @@ function prepareDatabaseForSuite(suite, context) { .db(context.dbName) .collection(context.collectionName) .distinct('x') - .catch(() => { }); + .catch(() => {}); }); }); } @@ -914,7 +914,7 @@ function testOperation(operation, obj, context, options) { () => { throw new Error('expected an error!'); }, - () => { } + () => {} ); }