@@ -1207,24 +1207,22 @@ const wcCommandsTests = {
12071207 noop : {
12081208 // Passing "*" will drop all indexes except the _id index. The only index on this
12091209 // collection is the _id index, so the command will be a no-op.
1210- req : {
1211- dropIndexes : collName ,
1212- index : "*" ,
1213- } ,
1210+ req : { dropIndexes : collName , index : "*" } ,
12141211 setupFunc : ( coll , cluster , clusterType , secondariesRunning , optionalArgs ) => {
1215- assert . commandWorked ( coll . insert ( { a : "a" } ) ) ;
1216- assert . eq ( coll . getIndexes ( ) . length , 1 ) ;
1212+ // Implicitly create the collection via insert if it doesn't exist
1213+ assert . commandWorked ( coll . insert ( { b : "b" } ) ) ;
12171214
12181215 stopAdditionalSecondariesIfSharded ( clusterType , cluster , secondariesRunning ) ;
1216+
1217+ optionalArgs . numIndexesBefore = coll . getIndexes ( ) . length ;
1218+ // Make a non-acknowledged write so that the no-op will have to fail with WCE
1219+ assert . commandWorkedIgnoringWriteConcernErrors (
1220+ coll . insert ( { b : "b" } , { writeConcern : { w : 3 , wtimeout : 100 } } ) ) ;
12191221 } ,
12201222 confirmFunc : ( res , coll , cluster , clusterType , secondariesRunning , optionalArgs ) => {
12211223 assert . commandWorkedIgnoringWriteConcernErrors ( res ) ;
1222- let details = res ;
1223- if ( "raw" in details ) {
1224- const raw = details . raw ;
1225- details = raw [ Object . keys ( raw ) [ 0 ] ] ;
1226- }
1227- assert . eq ( coll . getIndexes ( ) . length , 1 ) ;
1224+ assert . eq ( coll . getIndexes ( ) . length , optionalArgs . numIndexesBefore ) ;
1225+
12281226 restartAdditionalSecondariesIfSharded ( clusterType , cluster , secondariesRunning ) ;
12291227 } ,
12301228 } ,
@@ -3889,25 +3887,18 @@ const wcTimeseriesViewsCommandsTests = {
38893887 setupFunc : ( coll , cluster , clusterType , secondariesRunning , optionalArgs ) => {
38903888 assert . commandWorked ( coll . insert ( { meta : "a" , time : timeValue } ) ) ;
38913889 assert . commandWorked ( coll . getDB ( ) . runCommand ( { dropIndexes : collName , index : "*" } ) ) ;
3892- if ( clusterType == "sharded" ) {
3893- assert . eq ( coll . getIndexes ( ) . length , 1 ) ;
3894- } else {
3895- assert . eq ( coll . getIndexes ( ) . length , 0 ) ;
3896- }
3890+ optionalArgs . numIndexesBefore = coll . getIndexes ( ) . length ;
3891+
38973892 stopAdditionalSecondariesIfSharded ( clusterType , cluster , secondariesRunning ) ;
3893+
3894+ // Make a non-acknowledged write so that the no-op will have to fail with WCE
3895+ assert . commandWorkedIgnoringWriteConcernErrors ( coll . insert (
3896+ { meta : "a" , time : timeValue } , { writeConcern : { w : 'majority' , wtimeout : 100 } } ) ) ;
38983897 } ,
38993898 confirmFunc : ( res , coll , cluster , clusterType , secondariesRunning , optionalArgs ) => {
39003899 assert . commandWorkedIgnoringWriteConcernErrors ( res ) ;
3901- let details = res ;
3902- if ( "raw" in details ) {
3903- const raw = details . raw ;
3904- details = raw [ Object . keys ( raw ) [ 0 ] ] ;
3905- }
3906- if ( clusterType == "sharded" ) {
3907- assert . eq ( coll . getIndexes ( ) . length , 1 ) ;
3908- } else {
3909- assert . eq ( coll . getIndexes ( ) . length , 0 ) ;
3910- }
3900+ assert . eq ( coll . getIndexes ( ) . length , optionalArgs . numIndexesBefore ) ;
3901+
39113902 restartAdditionalSecondariesIfSharded ( clusterType , cluster , secondariesRunning ) ;
39123903 } ,
39133904 } ,
@@ -3935,12 +3926,8 @@ const wcTimeseriesViewsCommandsTests = {
39353926 } ,
39363927 confirmFunc : ( res , coll , cluster , clusterType , secondariesRunning , optionalArgs ) => {
39373928 assert . commandWorkedIgnoringWriteConcernErrors ( res ) ;
3938- let details = res ;
3939- if ( "raw" in details ) {
3940- const raw = details . raw ;
3941- details = raw [ Object . keys ( raw ) [ 0 ] ] ;
3942- }
39433929 assert . eq ( coll . getIndexes ( ) . length , optionalArgs . numIndexesBefore ) ;
3930+
39443931 restartAdditionalSecondariesIfSharded ( clusterType , cluster , secondariesRunning ) ;
39453932 } ,
39463933 } ,
@@ -5938,13 +5925,11 @@ function shouldSkipTestCase(
59385925 }
59395926
59405927 if ( testCase == "noop" ) {
5941- // TODO SERVER-100937 dropIndexes does not return WCE
5942-
59435928 // TODO SERVER-100309 adapt/enable setFeatureCompatibilityVersion no-op case once the
59445929 // upgrade procedure will not proactively shard the sessions collection.
59455930 if ( clusterType == "sharded" &&
59465931 ( shardedDDLCommandsRequiringMajorityCommit . includes ( command ) ||
5947- command == "dropIndexes" || command == " setFeatureCompatibilityVersion") ) {
5932+ command == "setFeatureCompatibilityVersion" ) ) {
59485933 jsTestLog ( "Skipping " + command + " test for no-op case." ) ;
59495934 return true ;
59505935 }
0 commit comments