@@ -427,53 +427,55 @@ describe('EndToEnd', () => {
427
427
) ;
428
428
} ) ;
429
429
430
- it ( 'runTransaction' , async ( ) => {
430
+ it ( 'runTransaction' , done => {
431
431
const withAllSpansHaveDBName = generateWithAllSpansHaveDBName (
432
432
database . formattedName_
433
433
) ;
434
434
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 ( ) ;
438
439
439
- traceExporter . forceFlush ( ) ;
440
- const spans = traceExporter . getFinishedSpans ( ) ;
441
- withAllSpansHaveDBName ( spans ) ;
440
+ traceExporter . forceFlush ( ) ;
441
+ const spans = traceExporter . getFinishedSpans ( ) ;
442
+ withAllSpansHaveDBName ( spans ) ;
442
443
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
+ } ) ;
449
451
} ) ;
450
- } ) ;
451
452
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
+ ) ;
462
463
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
+ } ) ;
477
479
} ) ;
478
480
479
481
it ( 'writeAtLeastOnce' , done => {
@@ -1508,7 +1510,6 @@ SELECT 1p
1508
1510
'CloudSpanner.Snapshot.begin' ,
1509
1511
'CloudSpanner.Transaction.commit' ,
1510
1512
'CloudSpanner.Transaction.commit' ,
1511
- 'CloudSpanner.Database.runTransactionAsync' ,
1512
1513
] ;
1513
1514
assert . deepStrictEqual (
1514
1515
actualSpanNames ,
@@ -2125,7 +2126,6 @@ describe('Traces for ExecuteStream broken stream retries', () => {
2125
2126
'CloudSpanner.Snapshot.begin' ,
2126
2127
'CloudSpanner.Transaction.commit' ,
2127
2128
'CloudSpanner.Transaction.commit' ,
2128
- 'CloudSpanner.Database.runTransactionAsync' ,
2129
2129
] ;
2130
2130
assert . deepStrictEqual (
2131
2131
actualSpanNames ,
@@ -2207,7 +2207,6 @@ describe('Traces for ExecuteStream broken stream retries', () => {
2207
2207
const expectedSpanNames = [
2208
2208
'CloudSpanner.Database.batchCreateSessions' ,
2209
2209
'CloudSpanner.SessionPool.createSessions' ,
2210
- 'CloudSpanner.Database.runTransactionAsync' ,
2211
2210
] ;
2212
2211
assert . deepStrictEqual (
2213
2212
actualSpanNames ,
0 commit comments