]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test/admin_socket: fix admin_socket unit tests
authorSage Weil <sage@inktank.com>
Sat, 27 Jul 2013 05:28:40 +0000 (22:28 -0700)
committerSage Weil <sage@inktank.com>
Sat, 27 Jul 2013 05:28:40 +0000 (22:28 -0700)
Command is now JSON!

Signed-off-by: Sage Weil <sage@inktank.com>
src/test/admin_socket.cc

index 7f595f596186ffbe431244ccb0b653046743430a..8f67918e644e41fffcd1d352c441b38f83f45bcb 100644 (file)
@@ -64,7 +64,7 @@ TEST(AdminSocket, SendNoOp) {
   ASSERT_EQ(true, asoct.init(get_rand_socket_path()));
   AdminSocketClient client(get_rand_socket_path());
   string version;
-  ASSERT_EQ("", client.do_request("0", &version));
+  ASSERT_EQ("", client.do_request("{\"prefix\":\"0\"}", &version));
   ASSERT_EQ(CEPH_ADMIN_SOCK_VERSION, version);
   ASSERT_EQ(true, asoct.shutdown());
 }
@@ -87,7 +87,7 @@ TEST(AdminSocket, RegisterCommand) {
   AdminSocketClient client(get_rand_socket_path());
   ASSERT_EQ(0, asoct.m_asokc->register_command("test", "test", new MyTest(), ""));
   string result;
-  ASSERT_EQ("", client.do_request("test", &result));
+  ASSERT_EQ("", client.do_request("{\"prefix\":\"test\"}", &result));
   ASSERT_EQ("test|", result);
   ASSERT_EQ(true, asoct.shutdown());
 }
@@ -111,20 +111,20 @@ TEST(AdminSocket, RegisterCommandPrefixes) {
   ASSERT_EQ(0, asoct.m_asokc->register_command("test", "test", new MyTest(), ""));
   ASSERT_EQ(0, asoct.m_asokc->register_command("test command", "test command", new MyTest2(), ""));
   string result;
-  ASSERT_EQ("", client.do_request("test", &result));
+  ASSERT_EQ("", client.do_request("{\"prefix\":\"test\"}", &result));
   ASSERT_EQ("test|", result);
-  ASSERT_EQ("", client.do_request("test command", &result));
+  ASSERT_EQ("", client.do_request("{\"prefix\":\"test command\"}", &result));
   ASSERT_EQ("test command|", result);
-  ASSERT_EQ("", client.do_request("test command post", &result));
+  ASSERT_EQ("", client.do_request("{\"prefix\":\"test command post\"}", &result));
   ASSERT_EQ("test command|post", result);
-  ASSERT_EQ("", client.do_request("test command  post", &result));
+  ASSERT_EQ("", client.do_request("{\"prefix\":\"test command  post\"}", &result));
   ASSERT_EQ("test command| post", result);
-  ASSERT_EQ("", client.do_request("test this thing", &result));
+  ASSERT_EQ("", client.do_request("{\"prefix\":\"test this thing\"}", &result));
   ASSERT_EQ("test|this thing", result);
 
-  ASSERT_EQ("", client.do_request("test  command post", &result));
+  ASSERT_EQ("", client.do_request("{\"prefix\":\"test  command post\"}", &result));
   ASSERT_EQ("test| command post", result);
-  ASSERT_EQ("", client.do_request("test  this thing", &result));
+  ASSERT_EQ("", client.do_request("{\"prefix\":\"test  this thing\"}", &result));
   ASSERT_EQ("test| this thing", result);
   ASSERT_EQ(true, asoct.shutdown());
 }