File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
test/integration/transactions Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change 11import { expect } from 'chai' ;
22import * as semver from 'semver' ;
33
4- import { type MongoClient } from '../../mongodb' ;
4+ import { type MongoClient , type ObjectId } from '../../mongodb' ;
55
66const metadata : MongoDBMetadataUI = {
77 requires : {
@@ -51,16 +51,18 @@ describe('Transactions Spec Prose', function () {
5151 '1.0 Write concern not inherited from collection object inside transaction.' ,
5252 metadata ,
5353 async ( ) => {
54+ let _id : ObjectId ;
55+ const collection = client . db ( ) . collection ( 'txn-test' , { writeConcern : { w : 0 } } ) ;
56+
5457 await client . withSession ( async session => {
5558 session . startTransaction ( ) ;
56-
57- const collection = client . db ( ) . collection ( 'txn-test' , { writeConcern : { w : 0 } } ) ;
58-
59- await collection . insertOne ( { n : 1 } , { session } ) ;
60-
59+ _id = ( await collection . insertOne ( { n : 1 } , { session } ) ) . insertedId ;
6160 await session . commitTransaction ( ) ;
6261 } ) ;
6362
63+ // keep finding until we get a result, otherwise the test will timeout.
64+ while ( ( await collection . findOne ( { _id } ) ) == null ) ;
65+
6466 const insertStarted = started . find ( ev => ev . commandName === 'insert' ) ;
6567 expect ( insertStarted ) . to . not . have . nested . property ( 'command.writeConcern' ) ;
6668
You can’t perform that action at this time.
0 commit comments