]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tests: adapt to new json-pretty format 3376/head
authorLoic Dachary <ldachary@redhat.com>
Thu, 15 Jan 2015 12:23:47 +0000 (13:23 +0100)
committerLoic Dachary <ldachary@redhat.com>
Thu, 15 Jan 2015 12:29:32 +0000 (13:29 +0100)
The json-pretty format was modified for readability and now includes
additional newlines / spaces. Either switch to json to avoid dealing
with space changes or modify the expected output to include them.

http://tracker.ceph.com/issues/10547 Fixes: #10547

Signed-off-by: Loic Dachary <ldachary@redhat.com>
src/test/ceph-helpers.sh
src/test/common/test_context.cc
src/test/crush/TestCrushWrapper.cc
src/test/perf_counters.cc

index 3eeda453a208b20eba9ee920dbd2954a4074108c..09d631c7d31c1f31f3caf49861156a4db6c59f8f 100755 (executable)
@@ -273,9 +273,9 @@ function test_run_mon() {
     setup $dir || return 1
 
     run_mon $dir a || return 1
-    local size=$(CEPH_ARGS='' ceph daemon $dir/ceph-mon.a.asok \
+    local size=$(CEPH_ARGS='' ceph --format=json daemon $dir/ceph-mon.a.asok \
         config get osd_pool_default_size)
-    test "$size" = '{ "osd_pool_default_size": "3"}' || return 1
+    test "$size" = '{"osd_pool_default_size":"3"}' || return 1
 
     ! CEPH_ARGS='' ceph status || return 1
     CEPH_ARGS='' ceph --conf $dir/ceph.conf status || return 1
@@ -283,16 +283,16 @@ function test_run_mon() {
     kill_daemons $dir
 
     run_mon $dir a --osd_pool_default_size=1 || return 1
-    local size=$(CEPH_ARGS='' ceph daemon $dir/ceph-mon.a.asok \
+    local size=$(CEPH_ARGS='' ceph --format=json daemon $dir/ceph-mon.a.asok \
         config get osd_pool_default_size)
-    test "$size" = '{ "osd_pool_default_size": "1"}' || return 1
+    test "$size" = '{"osd_pool_default_size":"1"}' || return 1
     kill_daemons $dir
 
     CEPH_ARGS="$CEPH_ARGS --osd_pool_default_size=2" \
         run_mon $dir a || return 1
-    local size=$(CEPH_ARGS='' ceph daemon $dir/ceph-mon.a.asok \
+    local size=$(CEPH_ARGS='' ceph --format=json daemon $dir/ceph-mon.a.asok \
         config get osd_pool_default_size)
-    test "$size" = '{ "osd_pool_default_size": "2"}' || return 1
+    test "$size" = '{"osd_pool_default_size":"2"}' || return 1
     kill_daemons $dir
 
     teardown $dir || return 1
@@ -359,19 +359,19 @@ function test_run_osd() {
     run_mon $dir a || return 1
 
     run_osd $dir 0 || return 1
-    local backfills=$(CEPH_ARGS='' ceph daemon $dir//ceph-osd.0.asok \
+    local backfills=$(CEPH_ARGS='' ceph --format=json daemon $dir//ceph-osd.0.asok \
         config get osd_max_backfills)
-    test "$backfills" = '{ "osd_max_backfills": "10"}' || return 1
+    test "$backfills" = '{"osd_max_backfills":"10"}' || return 1
 
     run_osd $dir 1 --osd-max-backfills 20 || return 1
-    local backfills=$(CEPH_ARGS='' ceph daemon $dir//ceph-osd.1.asok \
+    local backfills=$(CEPH_ARGS='' ceph --format=json daemon $dir//ceph-osd.1.asok \
         config get osd_max_backfills)
-    test "$backfills" = '{ "osd_max_backfills": "20"}' || return 1
+    test "$backfills" = '{"osd_max_backfills":"20"}' || return 1
 
     CEPH_ARGS="$CEPH_ARGS --osd-max-backfills 30" run_osd $dir 2 || return 1
-    local backfills=$(CEPH_ARGS='' ceph daemon $dir//ceph-osd.2.asok \
+    local backfills=$(CEPH_ARGS='' ceph --format=json daemon $dir//ceph-osd.2.asok \
         config get osd_max_backfills)
-    test "$backfills" = '{ "osd_max_backfills": "30"}' || return 1
+    test "$backfills" = '{"osd_max_backfills":"30"}' || return 1
 
     teardown $dir || return 1
 }
@@ -471,16 +471,16 @@ function test_activate_osd() {
     run_mon $dir a || return 1
 
     run_osd $dir 0 || return 1
-    local backfills=$(CEPH_ARGS='' ceph daemon $dir//ceph-osd.0.asok \
+    local backfills=$(CEPH_ARGS='' ceph --format=json daemon $dir//ceph-osd.0.asok \
         config get osd_max_backfills)
-    test "$backfills" = '{ "osd_max_backfills": "10"}' || return 1
+    test "$backfills" = '{"osd_max_backfills":"10"}' || return 1
 
     kill_daemons $dir TERM osd
 
     activate_osd $dir 0 --osd-max-backfills 20 || return 1
-    local backfills=$(CEPH_ARGS='' ceph daemon $dir//ceph-osd.0.asok \
+    local backfills=$(CEPH_ARGS='' ceph --format=json daemon $dir//ceph-osd.0.asok \
         config get osd_max_backfills)
-    test "$backfills" = '{ "osd_max_backfills": "20"}' || return 1
+    test "$backfills" = '{"osd_max_backfills":"20"}' || return 1
 
     teardown $dir || return 1
 }
index 0d0d2aaac5f8258db78fa383fe87a37ce0e9be92..c32fed30b32260142cea001152159b36f30a9511 100644 (file)
@@ -47,7 +47,7 @@ TEST(CephContext, do_command)
     bufferlist out;
     cct->do_command("config get", cmdmap, "UNSUPPORTED", &out);
     string s(out.c_str(), out.length());
-    EXPECT_EQ("{ \"key\": \"value\"}", s);
+    EXPECT_EQ("{\n    \"key\": \"value\"\n}\n", s);
   }
 
   cct->put();
index ac6e06c878e34f285c88f897846403a4caa695ce..b735b8469dd69b081de37031c53baaf5e906bd1d 100644 (file)
@@ -850,7 +850,7 @@ TEST(CrushWrapper, dump_rules) {
     stringstream ss;
     f->flush(ss);
     delete f;
-    EXPECT_EQ("", ss.str());
+    EXPECT_EQ("\n", ss.str());
   }
 
   string name("NAME");
index cac6b6558179dd65acfe02fca1db620e3914f8d9..9b6bd71b514444fc45a411662a9028238f2db0f9 100644 (file)
@@ -61,7 +61,7 @@ TEST(PerfCounters, SimpleTest) {
   AdminSocketClient client(get_rand_socket_path());
   std::string message;
   ASSERT_EQ("", client.do_request("{ \"prefix\": \"perf dump\" }", &message));
-  ASSERT_EQ("{}", message);
+  ASSERT_EQ("{}\n", message);
 }
 
 enum {