@@ -396,11 +396,54 @@ describe('316. sessionless.js', function() {
396
396
const res = await verifyConn . execute ( `SELECT * FROM ${ tableName } WHERE INTCOL IN (60, 61)` ) ;
397
397
await verifyConn . close ( ) ;
398
398
399
+ assert . strictEqual ( res . rows . length , 2 ) ;
400
+ await pool . close ( ) ;
401
+ } ) ;
402
+ it ( '316.4.2 same pooled connection with rollbacks/suspends' , async function ( ) {
403
+ const pool = await oracledb . createPool ( {
404
+ ...dbConfig ,
405
+ poolMin : 0 ,
406
+ poolMax : 1
407
+ } ) ;
408
+
409
+ const transactionId = '316.4.2' ;
410
+ let poolConn = await pool . getConnection ( ) ;
411
+
412
+ await poolConn . beginSessionlessTransaction ( { transactionId, timeout : 5 } ) ;
413
+ await poolConn . execute ( `INSERT INTO ${ tableName } VALUES(60, 'POOL_CONN')` ) ;
414
+ await poolConn . close ( ) ;
415
+
416
+ // begin transaction on same pooled connection(after release and re-acquire)
417
+ poolConn = await pool . getConnection ( ) ;
418
+ await poolConn . beginSessionlessTransaction ( { transactionId, timeout : 5 } ) ;
419
+ await poolConn . execute ( `INSERT INTO ${ tableName } VALUES(60, 'POOL_CONN')` ) ;
420
+ await poolConn . suspendSessionlessTransaction ( ) ;
421
+ await poolConn . close ( ) ;
422
+
423
+ // resume transaction on same pooled connection(after release and
424
+ // re-acquire) with suspendOnSuccess
425
+ poolConn = await pool . getConnection ( ) ;
426
+ await poolConn . resumeSessionlessTransaction ( transactionId , { timeout : 0 } ) ;
427
+ await poolConn . execute ( `INSERT INTO ${ tableName } VALUES(61, 'POOL_CONN')`
428
+ , { } , { suspendOnSuccess : true } ) ;
429
+ await poolConn . close ( ) ;
430
+
431
+ // commit from same reacquired connection
432
+ poolConn = await pool . getConnection ( ) ;
433
+ await poolConn . resumeSessionlessTransaction ( transactionId , { timeout : 0 , deferRoundTrip : true } ) ;
434
+ await poolConn . commit ( ) ;
435
+ await poolConn . close ( ) ;
436
+
437
+ const verifyConn = await pool . getConnection ( ) ;
438
+ const res = await verifyConn . execute ( `SELECT * FROM ${ tableName } WHERE INTCOL IN (60, 61)` ) ;
439
+ await verifyConn . close ( ) ;
440
+
399
441
assert . strictEqual ( res . rows . length , 2 ) ;
400
442
await pool . close ( ) ;
401
443
} ) ;
402
444
} ) ;
403
445
446
+
404
447
describe ( '316.5 Timeout and Error Handling' , function ( ) {
405
448
it ( '316.5.1 transaction timeout behavior' , async function ( ) {
406
449
const transactionId = '316.5.1' ;
0 commit comments