Couchbase in unit test and cleaning

We are using couchbase as a simple distributed key/value store.
We want to create some unit test that tests our usage of Couchbase and want to be able to clear the database for all data before starting the test.

So far we tried creating a development document to iterate over the keys in order to delete them.
This, for most of the times works, but it seems that the view is not always updated with the newest items right away.

What is the best approach for cleaning the database in an automated-test scenario?

We also took a look at Flushing, but this takes to long, and when the call is complete the bucket is not yet ready for the next test.
Deleting the bucket has the same problem as above.

Flush is async but it is the simplest way to delete all items. you can check completion by checking item count on the bucket on the flush through the admin API.
You could always drop the bucket and recreate it but that is an async operation as well.
thanks
-cihan