Fix tests

This pull request aims at fixing the test suit and making it less brittle. The following is a list of the changes and todo list

1. Add api to tell when the cluster is in sync
2. Remove all sleeps from the tests
2. Group all data tests in data_test.go with a convention of splitting initialization phase and test phase (TODO: run the tests in a cluster as well as standalone server)