@@ -50,7 +50,7 @@ describe('MongoCluster', function () {
5050
5151 try {
5252 cluster = await MongoCluster . start ( {
53- version : '6 .x' ,
53+ version : '8 .x' ,
5454 topology : 'standalone' ,
5555 tmpDir,
5656 downloadDir : customDownloadDir ,
@@ -65,7 +65,7 @@ describe('MongoCluster', function () {
6565
6666 expect ( MongoCluster [ 'downloadMongoDb' ] ) . to . have . been . calledWith (
6767 customDownloadDir ,
68- '6 .x' ,
68+ '8 .x' ,
6969 {
7070 platform : 'linux' ,
7171 arch : 'x64' ,
@@ -88,19 +88,34 @@ describe('MongoCluster', function () {
8888 expect ( ok ) . to . equal ( 1 ) ;
8989 } ) ;
9090
91- it ( 'can spawn a 6 .x standalone mongod on a pre-specified port ' , async function ( ) {
91+ it ( 'can spawn a 8 .x standalone mongod' , async function ( ) {
9292 cluster = await MongoCluster . start ( {
93- version : '6.x' ,
93+ version : '8.x' ,
94+ topology : 'standalone' ,
95+ tmpDir,
96+ } ) ;
97+ expect ( cluster . connectionString ) . to . be . a ( 'string' ) ;
98+ expect ( cluster . serverVersion ) . to . match ( / ^ 6 \. / ) ;
99+ expect ( cluster . serverVariant ) . to . equal ( 'community' ) ;
100+ const { ok } = await cluster . withClient ( async ( client ) => {
101+ return await client . db ( 'admin' ) . command ( { ping : 1 } ) ;
102+ } ) ;
103+ expect ( ok ) . to . equal ( 1 ) ;
104+ } ) ;
105+
106+ it ( 'can spawn a 8.x standalone mongod on a pre-specified port' , async function ( ) {
107+ cluster = await MongoCluster . start ( {
108+ version : '8.x' ,
94109 topology : 'standalone' ,
95110 tmpDir,
96111 args : [ '--port' , '50079' ] ,
97112 } ) ;
98113 expect ( cluster . connectionString ) . to . include ( `:50079` ) ;
99114 } ) ;
100115
101- it ( 'can spawn a 6 .x replset' , async function ( ) {
116+ it ( 'can spawn a 8 .x replset' , async function ( ) {
102117 cluster = await MongoCluster . start ( {
103- version : '6 .x' ,
118+ version : '8 .x' ,
104119 topology : 'replset' ,
105120 tmpDir,
106121 } ) ;
@@ -112,9 +127,9 @@ describe('MongoCluster', function () {
112127 expect ( + hello . passives . length + + hello . hosts . length ) . to . equal ( 3 ) ;
113128 } ) ;
114129
115- it ( 'can spawn a 6 .x replset with specific number of arbiters and secondaries' , async function ( ) {
130+ it ( 'can spawn a 8 .x replset with specific number of arbiters and secondaries' , async function ( ) {
116131 cluster = await MongoCluster . start ( {
117- version : '6 .x' ,
132+ version : '8 .x' ,
118133 topology : 'replset' ,
119134 tmpDir,
120135 secondaries : 3 ,
@@ -130,10 +145,10 @@ describe('MongoCluster', function () {
130145 expect ( hello . arbiters ) . to . have . lengthOf ( 1 ) ;
131146 } ) ;
132147
133- it ( 'can spawn a 6 .x sharded cluster' , async function ( ) {
148+ it ( 'can spawn a 8 .x sharded cluster' , async function ( ) {
134149 const logDir = path . join ( tmpDir , `sharded-logs` ) ;
135150 cluster = await MongoCluster . start ( {
136- version : '6 .x' ,
151+ version : '8 .x' ,
137152 topology : 'sharded' ,
138153 tmpDir,
139154 shards : 2 ,
@@ -156,9 +171,9 @@ describe('MongoCluster', function () {
156171 ) . to . equal ( 1 ) ;
157172 } ) ;
158173
159- it ( 'can spawn a 6 .x standalone mongod with TLS enabled and get build info' , async function ( ) {
174+ it ( 'can spawn a 8 .x standalone mongod with TLS enabled and get build info' , async function ( ) {
160175 cluster = await MongoCluster . start ( {
161- version : '6 .x' ,
176+ version : '8 .x' ,
162177 topology : 'standalone' ,
163178 tmpDir,
164179 args : [
@@ -289,7 +304,7 @@ describe('MongoCluster', function () {
289304
290305 it ( 'can serialize and deserialize sharded cluster info' , async function ( ) {
291306 cluster = await MongoCluster . start ( {
292- version : '6 .x' ,
307+ version : '8 .x' ,
293308 topology : 'sharded' ,
294309 tmpDir,
295310 secondaries : 0 ,
@@ -304,7 +319,7 @@ describe('MongoCluster', function () {
304319
305320 it ( 'can let callers listen for server log events' , async function ( ) {
306321 cluster = await MongoCluster . start ( {
307- version : '6 .x' ,
322+ version : '8 .x' ,
308323 topology : 'replset' ,
309324 tmpDir,
310325 secondaries : 1 ,
@@ -348,7 +363,7 @@ describe('MongoCluster', function () {
348363
349364 it ( 'can pass custom arguments for replica set members' , async function ( ) {
350365 cluster = await MongoCluster . start ( {
351- version : '6 .x' ,
366+ version : '8 .x' ,
352367 topology : 'replset' ,
353368 tmpDir,
354369 rsMembers : [
@@ -390,7 +405,7 @@ describe('MongoCluster', function () {
390405
391406 it ( 'can pass custom arguments for shards' , async function ( ) {
392407 cluster = await MongoCluster . start ( {
393- version : '6 .x' ,
408+ version : '8 .x' ,
394409 topology : 'sharded' ,
395410 tmpDir,
396411 secondaries : 0 ,
@@ -431,7 +446,7 @@ describe('MongoCluster', function () {
431446
432447 it ( 'can pass custom arguments for mongoses' , async function ( ) {
433448 cluster = await MongoCluster . start ( {
434- version : '6 .x' ,
449+ version : '8 .x' ,
435450 topology : 'sharded' ,
436451 tmpDir,
437452 secondaries : 0 ,
@@ -447,13 +462,15 @@ describe('MongoCluster', function () {
447462 const mongoses = cluster [ 'servers' ] ;
448463 expect ( mongoses ) . to . have . lengthOf ( 2 ) ;
449464 const values = await Promise . all (
450- mongoses . map ( ( srv ) =>
465+ mongoses . map ( ( srv , i ) =>
451466 srv . withClient ( async ( client ) => {
452467 return await Promise . all ( [
453468 client
454469 . db ( 'admin' )
455470 . command ( { getParameter : 1 , cursorTimeoutMillis : 1 } ) ,
456471 client . db ( 'admin' ) . command ( { hello : 1 } ) ,
472+ // Ensure that the mongos announces itself to the cluster
473+ client . db ( 'test' ) . collection ( `test${ i } ` ) . insertOne ( { dummy : 1 } ) ,
457474 ] ) ;
458475 } ) ,
459476 ) ,
@@ -481,7 +498,7 @@ describe('MongoCluster', function () {
481498
482499 it ( 'can add authentication options and verify them after serialization' , async function ( ) {
483500 cluster = await MongoCluster . start ( {
484- version : '6 .x' ,
501+ version : '8 .x' ,
485502 topology : 'sharded' ,
486503 tmpDir,
487504 secondaries : 1 ,
0 commit comments