summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoah Watkins <noahwatkins@gmail.com>2012-11-30 14:12:01 -0800
committerNoah Watkins <noahwatkins@gmail.com>2013-01-05 11:42:44 -0800
commit85824793f72a66059c8c20b50ab6f362feda3cbb (patch)
tree7e2d0b8e9cd8578ba1e2713442a7ca0ac6dc1d42
parente4427f23da30526565aa0524f2e4b014aabecb53 (diff)
downloadceph-85824793f72a66059c8c20b50ab6f362feda3cbb.tar.gz
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>
-rw-r--r--src/Makefile.am2
-rw-r--r--src/json_spirit/json_spirit_value.h2
-rw-r--r--src/test/libcephfs/test.cc26
3 files changed, 27 insertions, 3 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 97385af8666..c1490036944 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -929,7 +929,7 @@ bin_DEBUGPROGRAMS += test_rados_api_misc
test_libcephfs_SOURCES = test/libcephfs/test.cc test/libcephfs/caps.cc
test_libcephfs_LDFLAGS = $(PTHREAD_CFLAGS) ${AM_LDFLAGS}
-test_libcephfs_LDADD = ${UNITTEST_STATIC_LDADD} libcephfs.la
+test_libcephfs_LDADD = ${UNITTEST_STATIC_LDADD} libcephfs.la libcephtools.la
test_libcephfs_CXXFLAGS = $(AM_CXXFLAGS) ${UNITTEST_CXXFLAGS}
bin_DEBUGPROGRAMS += test_libcephfs
diff --git a/src/json_spirit/json_spirit_value.h b/src/json_spirit/json_spirit_value.h
index 344a99f0e14..62167e3971a 100644
--- a/src/json_spirit/json_spirit_value.h
+++ b/src/json_spirit/json_spirit_value.h
@@ -24,7 +24,7 @@
// comment out the value types you don't need to reduce build times and intermediate file sizes
#define JSON_SPIRIT_VALUE_ENABLED
//#define JSON_SPIRIT_WVALUE_ENABLED
-//#define JSON_SPIRIT_MVALUE_ENABLED
+#define JSON_SPIRIT_MVALUE_ENABLED
//#define JSON_SPIRIT_WMVALUE_ENABLED
namespace json_spirit
diff --git a/src/test/libcephfs/test.cc b/src/test/libcephfs/test.cc
index 4217badd6cf..d58364a63c4 100644
--- a/src/test/libcephfs/test.cc
+++ b/src/test/libcephfs/test.cc
@@ -24,6 +24,8 @@
#include <sstream>
#include <string>
#include <algorithm>
+#include "json_spirit/json_spirit.h"
+#include "tools/tools.h"
/*
* The bool parameter to control localized reads isn't used in
@@ -52,7 +54,7 @@ class ConfiguredMountTest : public ::testing::TestWithParam<bool> {
class MountedTest : public ConfiguredMountTest {
- std::string root;
+ std::string root, asok;
protected:
virtual void SetUp() {
@@ -70,6 +72,10 @@ class MountedTest : public ConfiguredMountTest {
root = unique_path;
root.insert(0, 1, '/');
+ /* Make /tmp path for client admin socket */
+ asok = unique_path;
+ asok.insert(0, "/tmp/");
+
/* Now mount */
ConfiguredMountTest::SetUp();
Mount();
@@ -87,6 +93,21 @@ class MountedTest : public ConfiguredMountTest {
Mount();
}
+ uint64_t get_objecter_replica_ops() {
+ /* Grab and parse the perf data if we haven't already */
+ std::stringstream ss;
+ ceph_tool_do_admin_socket(asok, "perf dump", ss);
+ std::string perfdump = ss.str();
+
+ json_spirit::mValue perfval;
+ json_spirit::read(perfdump, perfval);
+
+ json_spirit::mValue objecterVal = perfval.get_obj().find("objecter")->second;
+ json_spirit::mValue replicaVal = objecterVal.get_obj().find("op_send_replica")->second;
+
+ return replicaVal.get_uint64();
+ }
+
private:
void Mount() {
/* Setup clean room root directory */
@@ -105,6 +126,9 @@ class MountedTest : public ConfiguredMountTest {
ASSERT_EQ(ceph_unmount(cmount), 0);
ConfiguredMountTest::RefreshMount();
+ /* Setup admin socket */
+ ASSERT_EQ(ceph_conf_set(cmount, "admin_socket", asok.c_str()), 0);
+
/* Mount with new root directory */
ASSERT_EQ(ceph_mount(cmount, root.c_str()), 0);