test: cleanup opendir and shutdown in test

ceph_shutdown will hang unless we close the directory.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
Signed-off-by: Sam Lang <sam.lang@inktank.com>
test: consolidate tests into single file

This will avoid having to construct a new header file to be shared
between files with tests when the test fixture is added.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
test: auto create/cleanup ceph mount instances

Adds a test fixture which creates and destroys a ceph mount
automatically for each test. This lets us easily alter the mount before
each test runs. We'll use this to enable/disable local reads for each
test.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
test: run w/ and w/o read from replica enabled

This patch does two things. First, it uses value-parameterized version
of the test fixture which allows us to pass in a boolean flag that
enables/disable read from replica feature. We create two instances of
the fixture (true and false), so we run all the tests twice, once for
each state.

Existing tests use getpid() to create unique file names, but often don't
clean up after themselves. Since each tests is run in the same process
more than once, the names are no longer unique to the test instance. To
handle this case we change the fixture to construct a unique directory
that the mount is rooted in to create a clean room directory for each
test.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
osdc: track number of ops sent to a replica

Adds l_osdc_op_send_replica performance counter to count the number of
operations queued up on a connection to an osd that isn't the primary
for the operation being handled.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
tools: create noinst libtools_common

Creates a non-installed static libtools_common library from
tools/common.cc and moves do_admin_socket(..) into the library from
tools/ceph.cc. This routine is useful in the unit tests for connecting
to and querying an admin socket.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
test: access objecter ops sent to replica in gtest

Constructs a unique /tmp/path admin socket for the client before each
unit test. Adds an accessor for lazily reading performance counters to
grab the number of ops sent to a replica by the objecter.

Enables json_spirit MVALUE to make finding the value in the JSON easier.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
test: test for replica ops perf counter

Tests that the op_send_replica performance counter exists.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>