Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updated MongoServerTests to skip two unit tests when running against …

…a master/slave pair that were failing due to SERVER-2329.
  • Loading branch information...
commit 78de4078e2ed95a9a3e657443e20c908f7239b06 1 parent 8a5086d
rstam authored
Showing with 22 additions and 10 deletions.
  1. +22 −10 DriverUnitTests/Core/MongoServerTests.cs
View
32 DriverUnitTests/Core/MongoServerTests.cs
@@ -30,6 +30,7 @@ public class MongoServerTests
private MongoServer _server;
private MongoDatabase _database;
private MongoCollection<BsonDocument> _collection;
+ private bool _isMasterSlavePair;
[TestFixtureSetUp]
public void Setup()
@@ -37,6 +38,11 @@ public void Setup()
_server = Configuration.TestServer;
_database = Configuration.TestDatabase;
_collection = Configuration.TestCollection;
+
+ var adminDatabase = _server.GetDatabase("admin");
+ var commandResult = adminDatabase.RunCommand("getCmdLineOpts");
+ var argv = commandResult.Response["argv"].AsBsonArray;
+ _isMasterSlavePair = argv.Contains("--master") || argv.Contains("--slave");
}
// TODO: more tests for MongoServer
@@ -55,22 +61,28 @@ public void TestCreateNoArgs()
[Test]
public void TestDatabaseExists()
{
- _database.Drop();
- Assert.IsFalse(_server.DatabaseExists(_database.Name));
- _collection.Insert(new BsonDocument("x", 1));
- Assert.IsTrue(_server.DatabaseExists(_database.Name));
+ if (!_isMasterSlavePair)
+ {
+ _database.Drop();
+ Assert.IsFalse(_server.DatabaseExists(_database.Name));
+ _collection.Insert(new BsonDocument("x", 1));
+ Assert.IsTrue(_server.DatabaseExists(_database.Name));
+ }
}
[Test]
public void TestDropDatabase()
{
- _collection.Insert(new BsonDocument());
- var databaseNames = _server.GetDatabaseNames();
- Assert.IsTrue(databaseNames.Contains(_database.Name));
+ if (!_isMasterSlavePair)
+ {
+ _collection.Insert(new BsonDocument());
+ var databaseNames = _server.GetDatabaseNames();
+ Assert.IsTrue(databaseNames.Contains(_database.Name));
- var result = _server.DropDatabase(_database.Name);
- databaseNames = _server.GetDatabaseNames();
- Assert.IsFalse(databaseNames.Contains(_database.Name));
+ var result = _server.DropDatabase(_database.Name);
+ databaseNames = _server.GetDatabaseNames();
+ Assert.IsFalse(databaseNames.Contains(_database.Name));
+ }
}
[Test]
Please sign in to comment.
Something went wrong with that request. Please try again.