@@ -22,75 +22,84 @@ describe('Search Index Management Integration Tests', function () {
2222
2323 context ( 'when listSearchIndexes operation is run withTransaction' , function ( ) {
2424 // TODO(NODE-6047): Ignore read/write concern in applySession for Atlas Search Index Helpers
25- it ( 'should include write concern or read concern in command - TODO(NODE-6047)' , async function ( ) {
26- await client . withSession ( async session => {
27- return await session . withTransaction (
28- async ( ) => {
29- expect ( session . transaction . isStarting ) . to . equal ( true ) ;
30- expect ( session . transaction . isActive ) . to . equal ( true ) ;
31- try {
32- const res = collection . listSearchIndexes ( { session } ) ;
33- await res . toArray ( ) ;
34- } catch ( e ) {
35- // uncomment following assertion after NODE-6047 is completed
36- // expect(e.errmsg).to.match(/^.*Atlas.*$/);
37- } finally {
38- // uncomment following assertion after NODE-6047 is completed
39- // expect(commandStartedEvents[0]).to.exist;
40- if ( commandStartedEvents [ 0 ] ) {
41- // flip following assertion after NODE-6047 is completed
42- expect ( commandStartedEvents [ 0 ] ?. command ?. readConcern ) . to . exist ;
43- expect ( commandStartedEvents [ 0 ] ?. command ?. writeConcern ) . to . not . exist ;
25+ it ( 'should include write concern or read concern in command - TODO(NODE-6047)' , {
26+ metadata : { requires : { mongodb : '>4.2' } } ,
27+ test : async function ( ) {
28+ await client . withSession ( async session => {
29+ return await session . withTransaction (
30+ async ( ) => {
31+ expect ( session . transaction . isStarting ) . to . equal ( true ) ;
32+ expect ( session . transaction . isActive ) . to . equal ( true ) ;
33+ try {
34+ const res = collection . listSearchIndexes ( { session } ) ;
35+ await res . toArray ( ) ;
36+ } catch ( e ) {
37+ // uncomment following assertion after NODE-6047 is completed
38+ // expect(e.errmsg).to.match(/^.*Atlas.*$/);
39+ } finally {
40+ // uncomment following assertion after NODE-6047 is completed
41+ // expect(commandStartedEvents[0]).to.exist;
42+ if ( commandStartedEvents [ 0 ] ) {
43+ // flip following assertion after NODE-6047 is completed
44+ expect ( commandStartedEvents [ 0 ] ?. command ?. readConcern ) . to . exist ;
45+ expect ( commandStartedEvents [ 0 ] ?. command ?. writeConcern ) . to . not . exist ;
46+ }
4447 }
45- }
46- } ,
47- { readConcern : 'local' , writeConcern : { w : 1 } }
48- ) ;
49- } ) ;
48+ } ,
49+ { readConcern : 'local' , writeConcern : { w : 1 } }
50+ ) ;
51+ } ) ;
52+ }
5053 } ) ;
5154 } ) ;
5255
5356 context ( 'when listSearchIndexes operation is run with causalConsistency' , function ( ) {
54- it ( 'should include write concern or read concern in command - TODO(NODE-6047)' , async function ( ) {
55- await client . withSession ( { causalConsistency : true } , async session => {
56- try {
57- const res = collection . listSearchIndexes ( { session } ) ;
58- await res . toArray ( ) ;
59- } catch ( e ) {
60- // uncomment following assertion after NODE-6047 is completed
61- // expect(e.errmsg).to.match(/^.*Atlas.*$/);
62- } finally {
63- // uncomment following assertion after NODE-6047 is completed
64- // expect(commandStartedEvents[0]).to.exist;
65- if ( commandStartedEvents [ 0 ] ) {
66- expect ( commandStartedEvents [ 0 ] ?. command ?. readConcern ) . to . not . exist ;
67- expect ( commandStartedEvents [ 0 ] ?. command ?. writeConcern ) . to . not . exist ;
57+ it ( 'should include write concern or read concern in command - TODO(NODE-6047)' , {
58+ metadata : { requires : { mongodb : '>4.2' } } ,
59+ test : async function ( ) {
60+ await client . withSession ( { causalConsistency : true } , async session => {
61+ try {
62+ const res = collection . listSearchIndexes ( { session } ) ;
63+ await res . toArray ( ) ;
64+ } catch ( e ) {
65+ // uncomment following assertion after NODE-6047 is completed
66+ // expect(e.errmsg).to.match(/^.*Atlas.*$/);
67+ } finally {
68+ // uncomment following assertion after NODE-6047 is completed
69+ // expect(commandStartedEvents[0]).to.exist;
70+ if ( commandStartedEvents [ 0 ] ) {
71+ expect ( commandStartedEvents [ 0 ] ?. command ?. readConcern ) . to . not . exist ;
72+ expect ( commandStartedEvents [ 0 ] ?. command ?. writeConcern ) . to . not . exist ;
73+ }
6874 }
69- }
70- } ) ;
75+ } ) ;
76+ }
7177 } ) ;
7278 } ) ;
7379
7480 context ( 'when listSearchIndexes operation is run with snapshot on' , function ( ) {
7581 // TODO(NODE-6047): Ignore read/write concern in applySession for Atlas Search Index Helpers
76- it ( 'should include write concern or read concern in command - TODO(NODE-6047)' , async function ( ) {
77- await client . withSession ( { snapshot : true } , async session => {
78- try {
79- const res = collection . listSearchIndexes ( { session } ) ;
80- await res . toArray ( ) ;
81- } catch ( e ) {
82- // uncomment following assertion after NODE-6047 is completed
83- // expect(e.errmsg).to.match(/^.*Atlas.*$/);
84- } finally {
85- // uncomment following assertion after NODE-6047 is completed
86- // expect(commandStartedEvents[0]).to.exist;
87- if ( commandStartedEvents [ 0 ] ) {
88- // flip following assertion after NODE-6047 is completed
89- expect ( commandStartedEvents [ 0 ] ?. command ?. readConcern ) . to . exist ;
90- expect ( commandStartedEvents [ 0 ] ?. command ?. writeConcern ) . to . not . exist ;
82+ it ( 'should include write concern or read concern in command - TODO(NODE-6047)' , {
83+ metadata : { requires : { mongodb : '>4.2' } } ,
84+ test : async function ( ) {
85+ await client . withSession ( { snapshot : true } , async session => {
86+ try {
87+ const res = collection . listSearchIndexes ( { session } ) ;
88+ await res . toArray ( ) ;
89+ } catch ( e ) {
90+ // uncomment following assertion after NODE-6047 is completed
91+ // expect(e.errmsg).to.match(/^.*Atlas.*$/);
92+ } finally {
93+ // uncomment following assertion after NODE-6047 is completed
94+ // expect(commandStartedEvents[0]).to.exist;
95+ if ( commandStartedEvents [ 0 ] ) {
96+ // flip following assertion after NODE-6047 is completed
97+ expect ( commandStartedEvents [ 0 ] ?. command ?. readConcern ) . to . exist ;
98+ expect ( commandStartedEvents [ 0 ] ?. command ?. writeConcern ) . to . not . exist ;
99+ }
91100 }
92- }
93- } ) ;
101+ } ) ;
102+ }
94103 } ) ;
95104 } ) ;
96105 } ) ;
0 commit comments