From b957fa8ecfe67b21e369c669fb149cfc6e6e89e4 Mon Sep 17 00:00:00 2001 From: Loic Dachary Date: Thu, 15 Jan 2015 13:23:47 +0100 Subject: [PATCH] tests: adapt to new json-pretty format 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 --- src/test/ceph-helpers.sh | 32 +++++++++++++++--------------- src/test/common/test_context.cc | 2 +- src/test/crush/TestCrushWrapper.cc | 2 +- src/test/perf_counters.cc | 2 +- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/test/ceph-helpers.sh b/src/test/ceph-helpers.sh index 3eeda453a208b..09d631c7d31c1 100755 --- a/src/test/ceph-helpers.sh +++ b/src/test/ceph-helpers.sh @@ -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 } diff --git a/src/test/common/test_context.cc b/src/test/common/test_context.cc index 0d0d2aaac5f82..c32fed30b3226 100644 --- a/src/test/common/test_context.cc +++ b/src/test/common/test_context.cc @@ -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(); diff --git a/src/test/crush/TestCrushWrapper.cc b/src/test/crush/TestCrushWrapper.cc index ac6e06c878e34..b735b8469dd69 100644 --- a/src/test/crush/TestCrushWrapper.cc +++ b/src/test/crush/TestCrushWrapper.cc @@ -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"); diff --git a/src/test/perf_counters.cc b/src/test/perf_counters.cc index cac6b6558179d..9b6bd71b51444 100644 --- a/src/test/perf_counters.cc +++ b/src/test/perf_counters.cc @@ -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 { -- 2.39.5