File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed
tests/MongoDB.Driver.Legacy.Tests Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -478,14 +478,17 @@ public void TestCountWithQuery()
478
478
[ SkippableFact ]
479
479
public void TestCountWithReadPreferenceFromFind ( )
480
480
{
481
- RequireServer . Check ( ) ;
482
- _collection . Drop ( ) ;
481
+ RequireServer . Check ( ) . ClusterType ( ClusterType . ReplicaSet ) ;
483
482
var all = LegacyTestConfiguration . Server . Secondaries . Length + 1 ;
484
- var options = new MongoInsertOptions { WriteConcern = new WriteConcern ( w : all ) } ;
485
- _collection . Insert ( new BsonDocument ( "x" , 1 ) , options ) ;
486
- _collection . Insert ( new BsonDocument ( "x" , 2 ) , options ) ;
487
- var count = _collection . Find ( Query . EQ ( "x" , 1 ) ) . SetReadPreference ( ReadPreference . Secondary ) . Count ( ) ;
488
- Assert . Equal ( 1 , count ) ;
483
+ if ( all > 1 )
484
+ {
485
+ _collection . Drop ( ) ;
486
+ var options = new MongoInsertOptions { WriteConcern = new WriteConcern ( w : all ) } ;
487
+ _collection . Insert ( new BsonDocument ( "x" , 1 ) , options ) ;
488
+ _collection . Insert ( new BsonDocument ( "x" , 2 ) , options ) ;
489
+ var count = _collection . Find ( Query . EQ ( "x" , 1 ) ) . SetReadPreference ( ReadPreference . Secondary ) . Count ( ) ;
490
+ Assert . Equal ( 1 , count ) ;
491
+ }
489
492
}
490
493
491
494
[ SkippableFact ]
You can’t perform that action at this time.
0 commit comments