Contention between tasks in couchbase server 4.1 CE



i’m implementing a entitytagstore for couchbase to contribute to the cachecow project (

when i run the integration tests in my fork ( against the 4.1 Community edition i have this:

 // first remove them

        // add
        _entityTagStore.AddOrUpdate(cacheKey, value);
        _entityTagStore.AddOrUpdate(cacheKey2, value);

        // removing this fails the test

        // delete
        Assert.AreEqual(2, _entityTagStore.RemoveResource("/api/Cars"));

if i remove the thread.sleep, the test fails there any way to ensure that actions have been completed and written?