@@ -427,53 +427,55 @@ describe('EndToEnd', () => {
427427 ) ;
428428 } ) ;
429429
430- it ( 'runTransaction' , async ( ) => {
430+ it ( 'runTransaction' , done => {
431431 const withAllSpansHaveDBName = generateWithAllSpansHaveDBName (
432432 database . formattedName_
433433 ) ;
434434
435- await database . runTransactionAsync ( async transaction => {
436- return await transaction ! . run ( 'SELECT 1' ) ;
437- } ) ;
435+ database . runTransaction ( async ( err , transaction ) => {
436+ assert . ifError ( err ) ;
437+ const [ rows ] = await transaction ! . run ( 'SELECT 1' ) ;
438+ await transaction ! . commit ( ) ;
438439
439- traceExporter . forceFlush ( ) ;
440- const spans = traceExporter . getFinishedSpans ( ) ;
441- withAllSpansHaveDBName ( spans ) ;
440+ traceExporter . forceFlush ( ) ;
441+ const spans = traceExporter . getFinishedSpans ( ) ;
442+ withAllSpansHaveDBName ( spans ) ;
442443
443- const actualEventNames : string [ ] = [ ] ;
444- const actualSpanNames : string [ ] = [ ] ;
445- spans . forEach ( span => {
446- actualSpanNames . push ( span . name ) ;
447- span . events . forEach ( event => {
448- actualEventNames . push ( event . name ) ;
444+ const actualEventNames : string [ ] = [ ] ;
445+ const actualSpanNames : string [ ] = [ ] ;
446+ spans . forEach ( span => {
447+ actualSpanNames . push ( span . name ) ;
448+ span . events . forEach ( event => {
449+ actualEventNames . push ( event . name ) ;
450+ } ) ;
449451 } ) ;
450- } ) ;
451452
452- const expectedSpanNames = [
453- 'CloudSpanner.Snapshot.runStream' ,
454- 'CloudSpanner.Snapshot.run' ,
455- 'CloudSpanner.Database.runTransactionAsync ' ,
456- ] ;
457- assert . deepStrictEqual (
458- actualSpanNames ,
459- expectedSpanNames ,
460- `span names mismatch:\n\tGot: ${ actualSpanNames } \n\tWant: ${ expectedSpanNames } `
461- ) ;
453+ const expectedSpanNames = [
454+ 'CloudSpanner.Snapshot.runStream' ,
455+ 'CloudSpanner.Snapshot.run' ,
456+ 'CloudSpanner.Database.runTransaction ' ,
457+ ] ;
458+ assert . deepStrictEqual (
459+ actualSpanNames ,
460+ expectedSpanNames ,
461+ `span names mismatch:\n\tGot: ${ actualSpanNames } \n\tWant: ${ expectedSpanNames } `
462+ ) ;
462463
463- const expectedEventNames = [
464- 'Starting stream' ,
465- 'Transaction Creation Done' ,
466- 'Acquiring session' ,
467- 'Cache hit: has usable session' ,
468- 'Acquired session' ,
469- 'Using Session' ,
470- 'Transaction Attempt Succeeded' ,
471- ] ;
472- assert . deepStrictEqual (
473- actualEventNames ,
474- expectedEventNames ,
475- `Unexpected events:\n\tGot: ${ actualEventNames } \n\tWant: ${ expectedEventNames } `
476- ) ;
464+ const expectedEventNames = [
465+ 'Starting stream' ,
466+ 'Transaction Creation Done' ,
467+ 'Acquiring session' ,
468+ 'Cache hit: has usable session' ,
469+ 'Acquired session' ,
470+ 'Using Session' ,
471+ 'Transaction Attempt Succeeded' ,
472+ ] ;
473+ assert . deepStrictEqual (
474+ actualEventNames ,
475+ expectedEventNames ,
476+ `Unexpected events:\n\tGot: ${ actualEventNames } \n\tWant: ${ expectedEventNames } `
477+ ) ;
478+ } ) ;
477479 } ) ;
478480
479481 it ( 'writeAtLeastOnce' , done => {
@@ -1508,7 +1510,6 @@ SELECT 1p
15081510 'CloudSpanner.Snapshot.begin' ,
15091511 'CloudSpanner.Transaction.commit' ,
15101512 'CloudSpanner.Transaction.commit' ,
1511- 'CloudSpanner.Database.runTransactionAsync' ,
15121513 ] ;
15131514 assert . deepStrictEqual (
15141515 actualSpanNames ,
@@ -2125,7 +2126,6 @@ describe('Traces for ExecuteStream broken stream retries', () => {
21252126 'CloudSpanner.Snapshot.begin' ,
21262127 'CloudSpanner.Transaction.commit' ,
21272128 'CloudSpanner.Transaction.commit' ,
2128- 'CloudSpanner.Database.runTransactionAsync' ,
21292129 ] ;
21302130 assert . deepStrictEqual (
21312131 actualSpanNames ,
@@ -2207,7 +2207,6 @@ describe('Traces for ExecuteStream broken stream retries', () => {
22072207 const expectedSpanNames = [
22082208 'CloudSpanner.Database.batchCreateSessions' ,
22092209 'CloudSpanner.SessionPool.createSessions' ,
2210- 'CloudSpanner.Database.runTransactionAsync' ,
22112210 ] ;
22122211 assert . deepStrictEqual (
22132212 actualSpanNames ,
0 commit comments