TestFileStoreState: Represent a FileStore's state to be used by tests.

Instead of having each test creating the same representation of a
FileStore's state, with a map/set of collections and objects, as well as
multiple init() functions for each test that are in all similar in
nature, provide this in a single class that can be inheritted by test
classes.
DeterministicOpSequence: Generate a reproducible sequence of operations.

Signed-off-by: Joao Eduardo Luis <jecluis@gmail.com>
VerifyFileStore: Check if two FileStore's match after applying a set of operations.

With DeterministicOpSequence we are able to reproduce exactly the same
sequence of operations, over and over. However, if the filestore fails
(e.g., because we injected a failure), we want to check if it is kept
consistent after replaying its journal.

With VerifyFileStore, which extends DeterministicOpSequence, we are able
to bring a brand new filestore to the state the failed filestore would
reach had it not failed. We can then compare to check if the failure
introduced inconsistencies after replaying the journal.

(This is still work in progress and not fully functional)

Signed-off-by: Joao Eduardo Luis <jecluis@gmail.com>
test_idempotent_sequence: Generate a reproducible sequence of txs.

With this test we aim at reproducing the same sequence of transactions
as long as we are provided with the same seed between runs.

We also allow failures to be injected onto the filestore if the
--filestore-kill-at <VAL> argument is passed, and we provide verification
when --test-verify-at <VAL> is provided.

Signed-off-by: Joao Eduardo Luis <jecluis@gmail.com>
deterministicopseq: add collection_rename() support
test_idempotent_sequence: no need to reinject value that is already there

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
filestore: name internally

We need to allow the perfcounter name to be controlled so that we can have
two instances of FileStore in the same process that don't step on each
other.  Default to 'filestore'.

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
test_idempotent_sequence: Add commands and lose a couple of optional args.

Signed-off-by: Joao Eduardo Luis <jecluis@gmail.com>
filestore: init filestore_kill_at in ctor

Otherwise we don't get the option for FileStore instances created after
common_init_finish() (which does md_config_t::call_all_observers()).

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
test_idempotent_sequence: require nonexistent filestore dir

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
test_idempotent_sequence: include tx number in each transaction

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
test_idempotent_sequence: implement get-last-op

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
test_idempotent_sequence: whitesepace

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
test_idempotent_sequence: replace on coll_move

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
test_idempotent_sequence: simplify clone

- pick existing source
- any target is ok, as long as it != source

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
test_idempotent_sequence: make object names overlap

This way when we move objects between collections they will replace
each other in interesting ways.

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
test_idempotent_sequence: fewer objects per collection by default

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
test_idempotent_sequence: remove existing target for collection_add

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
test_idempotent_sequence: add remove op

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
test_idempotent_sequence: diff two stores.

Signed-off-by: Joao Eduardo Luis <jecluis@gmail.com>