@@ -1878,11 +1878,14 @@ describe('Database', () => {
18781878 . on ( 'error' , err => {
18791879 assert . fail ( err ) ;
18801880 } )
1881- . on ( 'end' , ( ) => {
1881+ . on ( 'end' , async ( ) => {
18821882 assert . strictEqual ( endStub . callCount , 1 ) ;
18831883 assert . strictEqual ( endStub2 . callCount , 1 ) ;
18841884 assert . strictEqual ( rows , 1 ) ;
18851885
1886+ await provider . forceFlush ( ) ;
1887+ await traceExporter . forceFlush ( ) ;
1888+
18861889 const spans = traceExporter . getFinishedSpans ( ) ;
18871890 assert . strictEqual ( spans . length , 2 , 'Exactly 1 span expected' ) ;
18881891 withAllSpansHaveDBName ( spans ) ;
@@ -1907,35 +1910,35 @@ describe('Database', () => {
19071910 ) ;
19081911
19091912 // Ensure that the span actually produced an error that was recorded.
1910- const secondSpan = spans [ 1 ] ;
1911- assert . strictEqual (
1913+ const lastSpan = spans [ 0 ] ;
1914+ assert . deepStrictEqual (
19121915 SpanStatusCode . ERROR ,
1913- secondSpan . status . code ,
1916+ lastSpan . status . code ,
19141917 'Expected an ERROR span status'
19151918 ) ;
1916- assert . strictEqual (
1919+ assert . deepStrictEqual (
19171920 'Session not found' ,
1918- secondSpan . status . message ,
1921+ lastSpan . status . message ,
19191922 'Mismatched span status message'
19201923 ) ;
19211924
19221925 // Ensure that the final span that got retries did not error.
1923- const firstSpan = spans [ 0 ] ;
1924- assert . strictEqual (
1926+ const firstSpan = spans [ 1 ] ;
1927+ assert . deepStrictEqual (
19251928 SpanStatusCode . UNSET ,
19261929 firstSpan . status . code ,
1927- 'Unexpected an span status code'
1930+ 'Unexpected span status code'
19281931 ) ;
1929- assert . strictEqual (
1932+ assert . deepStrictEqual (
19301933 undefined ,
19311934 firstSpan . status . message ,
19321935 'Unexpected span status message'
19331936 ) ;
19341937
19351938 const expectedEventNames = [
1936- 'Using Session' ,
19371939 'Using Session' ,
19381940 'No session available' ,
1941+ 'Using Session' ,
19391942 ] ;
19401943 assert . deepStrictEqual (
19411944 actualEventNames ,
0 commit comments