Contention between tasks in couchbase server 4.1 CE

i’m implementing a entitytagstore for couchbase to contribute to the cachecow project (https://github.com/aliostad/CacheCow).

when i run the integration tests in my fork (https://github.com/dgcaron/CacheCow) against the 4.1 Community edition i have this:

 // first remove them
        _entityTagStore.RemoveResource(cacheKey.ResourceUri);

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

        // removing this fails the test
        Thread.Sleep(TimeSpan.FromSeconds(1));

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

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