From: Kefu Chai Date: Mon, 20 Apr 2015 08:04:25 +0000 (+0800) Subject: Merge pull request #3847 from trociny/wip-test_with_crushtool.master X-Git-Tag: v9.0.1~115 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9403df27f6e825686587f35c69002ec314bfc582;p=ceph.git Merge pull request #3847 from trociny/wip-test_with_crushtool.master mon: ceph osd setcrushmap: test_with_crushtool improvements Reviewed-by: Kefu Chai --- 9403df27f6e825686587f35c69002ec314bfc582 diff --cc qa/workunits/cephtool/test.sh index 4a2e90ea0fc5,ef0b675d1ab4..fab48b53ce7d --- a/qa/workunits/cephtool/test.sh +++ b/qa/workunits/cephtool/test.sh @@@ -1431,29 -1427,60 +1431,69 @@@ function test_mon_crushmap_validation( { local map=$TMPDIR/map ceph osd getcrushmap -o $map - # crushtool validation timesout and is ignored - cat > $TMPDIR/crushtool <&1 | grep 'took too long' - ceph tell mon.* injectargs --crushtool crushtool - # crushtool validation succeeds + + local crushtool_path="${TMPDIR}/crushtool" + touch "${crushtool_path}" + chmod +x "${crushtool_path}" + local crushtool_path_old=`ceph-conf --show-config-value crushtool` + ceph tell mon.* injectargs --crushtool "${crushtool_path}" + + printf "%s\n" \ + "#!/bin/sh + cat > /dev/null + exit 0" > "${crushtool_path}" + + ceph osd setcrushmap -i $map + + printf "%s\n" \ + "#!/bin/sh + cat > /dev/null + exit 1" > "${crushtool_path}" + + expect_false ceph osd setcrushmap -i $map + + printf "%s\n" \ + "#!/bin/sh + cat > /dev/null + echo 'TEST FAIL' >&2 + exit 1" > "${crushtool_path}" + + expect_false ceph osd setcrushmap -i $map 2> $TMPFILE + check_response "Error EINVAL: Failed to parse crushmap: TEST FAIL" + + local mon_lease=`ceph-conf --show-config-value mon_lease` + + test "${mon_lease}" -gt 0 + + printf "%s\n" \ + "#!/bin/sh + cat > /dev/null + sleep $((mon_lease - 1))" > "${crushtool_path}" + ceph osd setcrushmap -i $map + + printf "%s\n" \ + "#!/bin/sh + cat > /dev/null + sleep $((mon_lease + 1))" > "${crushtool_path}" + + expect_false ceph osd setcrushmap -i $map 2> $TMPFILE + check_response "Error EINVAL: Failed to parse crushmap: ${crushtool_path}: timed out (${mon_lease} sec)" + + ceph tell mon.* injectargs --crushtool "${crushtool_path_old}" + + rm -f "${crushtool_path}" } +function test_mon_ping() +{ + ceph ping mon.a + ceph ping mon.b + expect_false ceph ping mon.foo + + ceph ping mon.* +} + # # New tests should be added to the TESTS array below # diff --cc src/test/Makefile.am index f724fad0e71d,36302159f218..4b4440d57cd5 --- a/src/test/Makefile.am +++ b/src/test/Makefile.am @@@ -409,8 -398,13 +409,13 @@@ check_TESTPROGRAMS += unittest_tablefor unittest_bit_vector_SOURCES = test/common/test_bit_vector.cc unittest_bit_vector_CXXFLAGS = $(UNITTEST_CXXFLAGS) unittest_bit_vector_LDADD = $(UNITTEST_LDADD) $(CEPH_GLOBAL) -check_PROGRAMS += unittest_bit_vector +check_TESTPROGRAMS += unittest_bit_vector + unittest_subprocess_SOURCES = test/test_subprocess.cc + unittest_subprocess_LDADD = $(LIBCOMMON) $(UNITTEST_LDADD) + unittest_subprocess_CXXFLAGS = $(UNITTEST_CXXFLAGS) + check_PROGRAMS += unittest_subprocess + check_SCRIPTS += test/pybind/test_ceph_argparse.py check_SCRIPTS += test/pybind/test_ceph_daemon.py