[CSHARP-1877] Race condition in TestDropAllIndexes test Created: 30/Dec/16  Updated: 06/Jan/17  Resolved: 06/Jan/17

Status: Closed
Project: C# Driver
Component/s: Testing
Affects Version/s: 2.0
Fix Version/s: 2.4.2

Type: Bug Priority: Minor - P4
Reporter: Robert Stam Assignee: Robert Stam
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

The TestDropAllIndexes test can fail depending on what order the tests are run in. The test assumes the database already exist but it might not.

Output of failed test:

    MongoDB.Driver.Tests.MongoCollectionTests.TestDropAllIndexes [FAIL]
      MongoDB.Driver.MongoCommandException : Command dropIndexes failed: database Tests12300427 not found.
      Stack Trace:
        D:\jenkins\workspace\mongo-csharp-driver-test-windows\4e0fc978\src\MongoDB.Driver.Core\Core\WireProtocol\CommandWireProtocol.cs(196,0): at MongoDB.Driver.Core.WireProtocol.CommandWireProtocol`1.ProcessReply(ConnectionId connectionId, ReplyMessage`1 reply)
        D:\jenkins\workspace\mongo-csharp-driver-test-windows\4e0fc978\src\MongoDB.Driver.Core\Core\WireProtocol\CommandWireProtocol.cs(111,0): at MongoDB.Driver.Core.WireProtocol.CommandWireProtocol`1.Execute(IConnection connection, CancellationToken cancellationToken)
        D:\jenkins\workspace\mongo-csharp-driver-test-windows\4e0fc978\src\MongoDB.Driver.Core\Core\Servers\Server.cs(698,0): at MongoDB.Driver.Core.Servers.Server.ServerChannel.ExecuteProtocol[TResult](IWireProtocol`1 protocol, CancellationToken cancellationToken)
        D:\jenkins\workspace\mongo-csharp-driver-test-windows\4e0fc978\src\MongoDB.Driver.Core\Core\Servers\Server.cs(348,0): at MongoDB.Driver.Core.Servers.Server.ServerChannel.Command[TResult](DatabaseNamespace databaseNamespace, BsonDocument command, IElementNameValidator commandValidator, Func`1 responseHandling, Boolean slaveOk, IBsonSerializer`1 resultSerializer, MessageEncoderSettings messageEncoderSettings, CancellationToken cancellationToken)
        D:\jenkins\workspace\mongo-csharp-driver-test-windows\4e0fc978\src\MongoDB.Driver.Core\Core\Operations\CommandOperationBase.cs(181,0): at MongoDB.Driver.Core.Operations.CommandOperationBase`1.ExecuteProtocol(IChannelHandle channel, ServerDescription serverDescription, ReadPreference readPreference, CancellationToken cancellationToken)
        D:\jenkins\workspace\mongo-csharp-driver-test-windows\4e0fc978\src\MongoDB.Driver.Core\Core\Operations\CommandOperationBase.cs(206,0): at MongoDB.Driver.Core.Operations.CommandOperationBase`1.ExecuteProtocol(IChannelSource channelSource, ReadPreference readPreference, CancellationToken cancellationToken)
        D:\jenkins\workspace\mongo-csharp-driver-test-windows\4e0fc978\src\MongoDB.Driver.Core\Core\Operations\WriteCommandOperation.cs(57,0): at MongoDB.Driver.Core.Operations.WriteCommandOperation`1.Execute(IWriteBinding binding, CancellationToken cancellationToken)
        D:\jenkins\workspace\mongo-csharp-driver-test-windows\4e0fc978\src\MongoDB.Driver.Core\Core\Operations\DropIndexOperation.cs(151,0): at MongoDB.Driver.Core.Operations.DropIndexOperation.Execute(IWriteBinding binding, CancellationToken cancellationToken)
        D:\jenkins\workspace\mongo-csharp-driver-test-windows\4e0fc978\src\MongoDB.Driver.Legacy\MongoCollection.cs(2093,0): at MongoDB.Driver.MongoCollection.ExecuteWriteOperation[TResult](IWriteOperation`1 operation)
        D:\jenkins\workspace\mongo-csharp-driver-test-windows\4e0fc978\src\MongoDB.Driver.Legacy\MongoCollection.cs(418,0): at MongoDB.Driver.MongoCollection.DropIndexByName(String indexName)
        D:\jenkins\workspace\mongo-csharp-driver-test-windows\4e0fc978\src\MongoDB.Driver.Legacy\MongoCollection.cs(382,0): at MongoDB.Driver.MongoCollection.DropAllIndexes()
        D:\jenkins\workspace\mongo-csharp-driver-test-windows\4e0fc978\tests\MongoDB.Driver.Legacy.Tests\MongoCollectionTests.cs(853,0): at MongoDB.Driver.Tests.MongoCollectionTests.TestDropAllIndexes()



 Comments   
Comment by Githook User [ 06/Jan/17 ]

Author:

{u'username': u'rstam', u'name': u'rstam', u'email': u'robert@robertstam.org'}

Message: CSHARP-1877: Drop the collection at the beginning of every test in MongoCollectionTests so that every test starts with a clean slate.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/ee9491ccb909a15006d5e92e5d1e7ec8ab965514

Generated at Wed Feb 07 21:40:55 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.