1414 * limitations under the License.
1515 */
1616
17- import * as semver from 'semver' ;
1817import { context , trace , SpanStatusCode } from '@opentelemetry/api' ;
1918import { AsyncHooksContextManager } from '@opentelemetry/context-async-hooks' ;
2019import {
@@ -34,12 +33,8 @@ import {
3433 SimpleSpanProcessor ,
3534} from '@opentelemetry/sdk-trace-base' ;
3635import * as assert from 'assert' ;
37- import {
38- MySQL2Instrumentation ,
39- MySQL2InstrumentationConfig ,
40- } from '../src' ;
36+ import { MySQL2Instrumentation , MySQL2InstrumentationConfig } from '../src' ;
4137
42- const LIB_VERSION = testUtils . getPackageVersion ( 'mysql2' ) ;
4338const port = Number ( process . env . MYSQL_PORT ) || 33306 ;
4439const database = process . env . MYSQL_DATABASE || 'test_db' ;
4540const host = process . env . MYSQL_HOST || '127.0.0.1' ;
@@ -158,11 +153,7 @@ describe('mysql2/promise', () => {
158153 instrumentation . disable ( ) ;
159154 await connection . end ( ) ;
160155 await pool . end ( ) ;
161- if ( isPoolClusterEndIgnoreCallback ( ) ) {
162- await poolCluster . end ( ) ;
163- } else {
164- await poolCluster . end ( ) ;
165- }
156+ await poolCluster . end ( ) ;
166157 } ) ;
167158
168159 describe ( 'when the query is a string' , ( ) => {
@@ -972,9 +963,3 @@ function assertSpan(
972963 assert . strictEqual ( span . status . code , SpanStatusCode . ERROR ) ;
973964 }
974965}
975-
976- function isPoolClusterEndIgnoreCallback ( ) {
977- // Since v2.2.0 `end` function respect callback
978- // https://github.com/sidorares/node-mysql2/commit/1481015626e506754adc4308e5508356a3a03aa0
979- return semver . lt ( LIB_VERSION , '2.2.0' ) ;
980- }
0 commit comments