Skip to content

Commit 6b88fdb

Browse files
committed
chore: updates cripts for oracle and pg instrumentations
1 parent dafcf86 commit 6b88fdb

File tree

4 files changed

+14
-46
lines changed

4 files changed

+14
-46
lines changed

packages/instrumentation-oracledb/package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@
2020
"prepublishOnly": "npm run compile",
2121
"tdd": "npm run test -- --watch-extensions ts --watch",
2222
"test": "nyc mocha 'test/**/*.test.ts'",
23-
"test-all-versions": "tav",
24-
"test-all-versions:local": "cross-env RUN_ORACLEDB_TESTS_LOCAL=true npm run test-all-versions",
2523
"test:debug": "mocha --inspect-brk --no-timeouts 'test/**/*.test.ts'",
26-
"test:local": "cross-env RUN_ORACLEDB_TESTS_LOCAL=true npm run test",
24+
"test:with-services-env": "cross-env NODE_OPTIONS='-r dotenv/config' DOTENV_CONFIG_PATH=../../test/test-services.env npm test",
25+
"test-all-versions": "tav",
26+
"test-all-versions:with-services-env": "cross-env NODE_OPTIONS='-r dotenv/config' DOTENV_CONFIG_PATH=../../test/test-services.env npm run test-all-versions",
27+
"test-services:start": "cd ../.. && npm run test-services:start oracledb",
28+
"test-services:stop": "cd ../.. && npm run test-services:stop oracledb",
2729
"version:update": "node ../../scripts/version-update.js",
2830
"watch": "tsc -w"
2931
},

packages/instrumentation-oracledb/test/oracle.test.ts

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -395,8 +395,7 @@ describe('oracledb', () => {
395395
let connection: oracledb.Connection;
396396

397397
const testOracleDB = process.env.RUN_ORACLEDB_TESTS; // For CI: assumes local oracledb is already available
398-
const testOracleDBLocally = process.env.RUN_ORACLEDB_TESTS_LOCAL; // For local: spins up local oracledb via docker
399-
const shouldTest = testOracleDB || testOracleDBLocally; // Skips these tests if false (default)
398+
const shouldTest = testOracleDB; // Skips these tests if false (default)
400399
const sql = 'select 1 from dual';
401400
const sqlWithBinds = 'select :1 from dual';
402401
const sqlWithBindsByName = 'select :name from dual';
@@ -483,29 +482,7 @@ describe('oracledb', () => {
483482
skip();
484483
}
485484

486-
if (testOracleDBLocally) {
487-
testUtils.startDocker('oracledb');
488-
489-
// increase test time
490-
this.timeout(50000);
491-
492-
// check if docker container is up
493-
let retries = 6;
494-
while (retries-- > 0) {
495-
try {
496-
connection = await oracledb.getConnection(CONFIG);
497-
break;
498-
} catch (err) {
499-
console.log('retry count %d failed waiting for DB', retries);
500-
await new Promise(r => setTimeout(r, 10000));
501-
}
502-
}
503-
if (retries < 0) {
504-
throw new Error('docker setup Failed');
505-
}
506-
} else {
507-
connection = await oracledb.getConnection(CONFIG);
508-
}
485+
connection = await oracledb.getConnection(CONFIG);
509486
await doSetup();
510487
updateAttrSpanList(connection);
511488
contextManager = new AsyncLocalStorageContextManager().enable();
@@ -520,10 +497,6 @@ describe('oracledb', () => {
520497
await connection.close();
521498
}
522499
instrumentation.disable();
523-
if (testOracleDBLocally) {
524-
this.timeout(5000);
525-
testUtils.cleanUpDocker('oracledb');
526-
}
527500
});
528501

529502
beforeEach(() => {

packages/instrumentation-pg/package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@
1919
"prepublishOnly": "npm run compile",
2020
"tdd": "npm run test -- --watch-extensions ts --watch",
2121
"test": "nyc mocha 'test/**/*.test.ts'",
22-
"test-all-versions": "tav",
23-
"test-all-versions:local": "cross-env RUN_POSTGRES_TESTS_LOCAL=true npm run test-all-versions",
2422
"test:debug": "mocha --inspect-brk --no-timeouts 'test/**/*.test.ts'",
25-
"test:local": "cross-env RUN_POSTGRES_TESTS_LOCAL=true npm run test",
23+
"test:with-services-env": "cross-env NODE_OPTIONS='-r dotenv/config' DOTENV_CONFIG_PATH=../../test/test-services.env npm test",
24+
"test-all-versions": "tav",
25+
"test-all-versions:with-services-env": "cross-env NODE_OPTIONS='-r dotenv/config' DOTENV_CONFIG_PATH=../../test/test-services.env npm run test-all-versions",
26+
"test-services:start": "cd ../.. && npm run test-services:start postgres",
27+
"test-services:stop": "cd ../.. && npm run test-services:stop postgres",
2628
"version:update": "node ../../scripts/version-update.js",
2729
"watch": "tsc -w"
2830
},

packages/instrumentation-pg/test/pg-pool.test.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,8 @@ describe('pg-pool', () => {
127127
spanProcessors: [new SimpleSpanProcessor(memoryExporter)],
128128
});
129129

130-
const testPostgres = process.env.RUN_POSTGRES_TESTS; // For CI: assumes local postgres db is already available
131-
const testPostgresLocally = process.env.RUN_POSTGRES_TESTS_LOCAL; // For local: spins up local postgres db via docker
132-
const shouldTest = testPostgres || testPostgresLocally; // Skips these tests if false (default)
130+
const testPostgres = process.env.RUN_POSTGRES_TESTS;
131+
const shouldTest = testPostgres; // Skips these tests if false (default)
133132

134133
before(function () {
135134
const skip = () => {
@@ -143,10 +142,6 @@ describe('pg-pool', () => {
143142
skip();
144143
}
145144

146-
if (testPostgresLocally) {
147-
testUtils.startDocker('postgres');
148-
}
149-
150145
instrumentation = new PgInstrumentation();
151146

152147
contextManager = new AsyncLocalStorageContextManager().enable();
@@ -158,10 +153,6 @@ describe('pg-pool', () => {
158153
});
159154

160155
after(done => {
161-
if (testPostgresLocally) {
162-
testUtils.cleanUpDocker('postgres');
163-
}
164-
165156
pool.end(() => {
166157
done();
167158
});

0 commit comments

Comments
 (0)