-
Notifications
You must be signed in to change notification settings - Fork 538
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Naseem <[email protected]>
- Loading branch information
Naseem
committed
Oct 6, 2020
1 parent
c36c9e8
commit 9055d97
Showing
1 changed file
with
23 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -124,30 +124,34 @@ describe('[email protected]', () => { | |
assert.strictEqual(plugin.moduleName, 'mysql'); | ||
}); | ||
|
||
it('should name the span correctly when the query is a string', done => { | ||
const span = provider.getTracer('default').startSpan('test span'); | ||
provider.getTracer('default').withSpan(span, () => { | ||
const sql = 'SELECT 1+1 as solution'; | ||
const query = connection.query(sql); | ||
|
||
query.on('end', () => { | ||
const spans = memoryExporter.getFinishedSpans(); | ||
assert.strictEqual(spans[0].name, 'SELECT'); | ||
done(); | ||
describe('when the query is a string', () => { | ||
it('should name the span accordingly ', done => { | ||
const span = provider.getTracer('default').startSpan('test span'); | ||
provider.getTracer('default').withSpan(span, () => { | ||
const sql = 'SELECT 1+1 as solution'; | ||
const query = connection.query(sql); | ||
|
||
query.on('end', () => { | ||
const spans = memoryExporter.getFinishedSpans(); | ||
assert.strictEqual(spans[0].name, 'SELECT'); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
|
||
it('should name the span correctly when the query is an object', done => { | ||
const span = provider.getTracer('default').startSpan('test span'); | ||
provider.getTracer('default').withSpan(span, () => { | ||
const sql = 'SELECT 1+? as solution'; | ||
const query = connection.query({ sql, values: [1] }); | ||
describe('when the query is an object', () => { | ||
it('should name the span accordingly ', done => { | ||
const span = provider.getTracer('default').startSpan('test span'); | ||
provider.getTracer('default').withSpan(span, () => { | ||
const sql = 'SELECT 1+? as solution'; | ||
const query = connection.query({ sql, values: [1] }); | ||
|
||
query.on('end', () => { | ||
const spans = memoryExporter.getFinishedSpans(); | ||
assert.strictEqual(spans[0].name, sql); | ||
done(); | ||
query.on('end', () => { | ||
const spans = memoryExporter.getFinishedSpans(); | ||
assert.strictEqual(spans[0].name, sql); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
|