Skip to content

Commit

Permalink
test(mysql): use environment for test params
Browse files Browse the repository at this point in the history
  • Loading branch information
dyladan committed Nov 18, 2019
1 parent f598eac commit 43f1556
Showing 1 changed file with 21 additions and 15 deletions.
36 changes: 21 additions & 15 deletions packages/opentelemetry-plugin-mysql/test/mysql.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ import { MysqlPlugin, plugin } from '../src';
import * as testUtils from './testUtils';
import { AttributeNames } from '../src/enums';

const port = parseInt(process.env.MYSQL_PORT || '33306', 10);
const database = process.env.MYSQL_DATABASE || 'test_db';
const host = process.env.MYSQL_HOST || '127.0.0.1';
const user = process.env.MYSQL_USER || 'otel';
const password = process.env.MYSQL_PASSWORD || 'secret';

describe('[email protected]', () => {
let connection: mysql.Connection;
let pool: mysql.Pool;
Expand Down Expand Up @@ -65,26 +71,26 @@ describe('[email protected]', () => {
beforeEach(function() {
plugin.enable(mysql, tracer, logger);
connection = mysql.createConnection({
port: 33306,
user: 'otel',
host: '127.0.0.1',
password: 'secret',
database: "test_db",
port,
user,
host,
password,
database,
});
pool = mysql.createPool({
port: 33306,
user: 'otel',
host: '127.0.0.1',
password: 'secret',
database: "test_db",
port,
user,
host,
password,
database,
});
poolCluster = mysql.createPoolCluster();
poolCluster.add({
port: 33306,
user: 'otel',
host: '127.0.0.1',
password: 'secret',
database: "test_db",
port,
user,
host,
password,
database,
});
});

Expand Down

0 comments on commit 43f1556

Please sign in to comment.