]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
test: add new testcase for request admin_socket with long request
authorYunchuan Wen <yunchuan.wen@kylin-cloud.com>
Sat, 17 Dec 2016 00:40:26 +0000 (08:40 +0800)
committerYunchuan Wen <yunchuan.wen@kylin-cloud.com>
Sat, 17 Dec 2016 00:40:26 +0000 (08:40 +0800)
Signed-off-by: Yunchuan Wen <yunchuan.wen@kylin-cloud.com>
src/test/admin_socket.cc

index 3f9fc0c5260d4ec2b06d10670c4abf9ace16b869..a3fdeaae538de6c801d38c2c3415f6368f779fac 100644 (file)
@@ -105,6 +105,20 @@ TEST(AdminSocket, SendNoOp) {
   ASSERT_EQ(true, asoct.shutdown());
 }
 
+TEST(AdminSocket, SendTooLongRequest) {
+  std::unique_ptr<AdminSocket>
+      asokc(new AdminSocket(g_ceph_context));
+  AdminSocketTest asoct(asokc.get());
+  ASSERT_EQ(true, asoct.shutdown());
+  ASSERT_EQ(true, asoct.init(get_rand_socket_path()));
+  AdminSocketClient client(get_rand_socket_path());
+  string version;
+  string request(16384, 'a');
+  //if admin_socket cannot handle it, segfault will happened.
+  ASSERT_NE("", client.do_request(request, &version));
+  ASSERT_EQ(true, asoct.shutdown());
+}
+
 class MyTest : public AdminSocketHook {
   bool call(std::string command, cmdmap_t& cmdmap, std::string format, bufferlist& result) {
     std::vector<std::string> args;