From 13bbbcc328faabca786e4c1ee272988fdc4d3bfe Mon Sep 17 00:00:00 2001 From: Onur Temizkan Date: Thu, 5 Dec 2024 19:43:16 +0000 Subject: [PATCH] Cleanup --- .../test/fixtures/use-pg.mjs | 1 - .../opentelemetry-instrumentation-pg/test/pg-pool.test.ts | 5 ++--- .../opentelemetry-instrumentation-pg/test/pg.esm.test.ts | 6 +++--- .../node/opentelemetry-instrumentation-pg/test/pg.test.ts | 4 ---- 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/plugins/node/opentelemetry-instrumentation-pg/test/fixtures/use-pg.mjs b/plugins/node/opentelemetry-instrumentation-pg/test/fixtures/use-pg.mjs index b571f3f68a..455401e078 100644 --- a/plugins/node/opentelemetry-instrumentation-pg/test/fixtures/use-pg.mjs +++ b/plugins/node/opentelemetry-instrumentation-pg/test/fixtures/use-pg.mjs @@ -43,7 +43,6 @@ import pg from 'pg'; const client = new pg.Client(CONFIG); -await new Promise(resolve => setTimeout(resolve, 4000)); await client.connect(); const tracer = trace.getTracer(); diff --git a/plugins/node/opentelemetry-instrumentation-pg/test/pg-pool.test.ts b/plugins/node/opentelemetry-instrumentation-pg/test/pg-pool.test.ts index efa3fa6db1..f0ac1508d9 100644 --- a/plugins/node/opentelemetry-instrumentation-pg/test/pg-pool.test.ts +++ b/plugins/node/opentelemetry-instrumentation-pg/test/pg-pool.test.ts @@ -68,7 +68,7 @@ const CONFIG = { ? parseInt(process.env.POSTGRES_PORT, 10) : 54320, maxClient: 1, - idleTimeoutMillis: 30000, + idleTimeoutMillis: 10000, }; const DEFAULT_PGPOOL_ATTRIBUTES = { @@ -125,7 +125,7 @@ describe('pg-pool', () => { const testPostgresLocally = process.env.RUN_POSTGRES_TESTS_LOCAL; // For local: spins up local postgres db via docker const shouldTest = testPostgres || testPostgresLocally; // Skips these tests if false (default) - before(function (done) { + before(function () { const skip = () => { // this.skip() workaround // https://github.com/mochajs/mocha/issues/2683#issuecomment-375629901 @@ -150,7 +150,6 @@ describe('pg-pool', () => { const pgPool = require('pg-pool'); pool = new pgPool(CONFIG); - setTimeout(done, 3000); }); after(done => { diff --git a/plugins/node/opentelemetry-instrumentation-pg/test/pg.esm.test.ts b/plugins/node/opentelemetry-instrumentation-pg/test/pg.esm.test.ts index 0e1dd6a4d1..8fb75ebcb4 100644 --- a/plugins/node/opentelemetry-instrumentation-pg/test/pg.esm.test.ts +++ b/plugins/node/opentelemetry-instrumentation-pg/test/pg.esm.test.ts @@ -21,7 +21,7 @@ describe('pg ESM usage', () => { const testPostgresLocally = process.env.RUN_POSTGRES_TESTS_LOCAL; // For local: spins up local postgres db via docker const shouldTest = testPostgres || testPostgresLocally; // Skips these tests if false (default) - before(async function () { + before(function () { const skip = () => { // this.skip() workaround // https://github.com/mochajs/mocha/issues/2683#issuecomment-375629901 @@ -38,7 +38,7 @@ describe('pg ESM usage', () => { } }); - after(async () => { + after(() => { if (testPostgresLocally) { testUtils.cleanUpDocker('postgres'); } @@ -53,7 +53,7 @@ describe('pg ESM usage', () => { '--experimental-loader=@opentelemetry/instrumentation/hook.mjs', NODE_NO_WARNINGS: '1', }, - checkResult: err => { + checkResult: (err, stdout, stderr) => { assert.ifError(err); }, checkCollector: (collector: testUtils.TestCollector) => { diff --git a/plugins/node/opentelemetry-instrumentation-pg/test/pg.test.ts b/plugins/node/opentelemetry-instrumentation-pg/test/pg.test.ts index e68ffd0946..c87ef34db1 100644 --- a/plugins/node/opentelemetry-instrumentation-pg/test/pg.test.ts +++ b/plugins/node/opentelemetry-instrumentation-pg/test/pg.test.ts @@ -153,14 +153,10 @@ describe('pg', () => { postgres = require('pg'); client = new postgres.Client(CONFIG); - await new Promise(resolve => setTimeout(resolve, 3000)); - await client.connect(); }); after(async () => { - await new Promise(resolve => setTimeout(resolve, 3000)); - if (testPostgresLocally) { testUtils.cleanUpDocker('postgres'); }