2013-07-31 06:04:41 +00:00
|
|
|
#!/bin/bash -x
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
expect_false()
|
|
|
|
{
|
|
|
|
set -x
|
|
|
|
if "$@"; then return 1; else return 0; fi
|
|
|
|
}
|
|
|
|
|
2014-07-30 21:49:02 +00:00
|
|
|
echo note: assuming mon.a is on the current host
|
2013-07-31 06:04:41 +00:00
|
|
|
|
2014-07-30 21:48:28 +00:00
|
|
|
# can set to 'sudo ./ceph' to execute tests from current dir for development
|
|
|
|
CEPH=${CEPH:-'sudo ceph'}
|
|
|
|
|
|
|
|
${CEPH} daemon mon.a version | grep version
|
2013-07-31 06:04:41 +00:00
|
|
|
|
|
|
|
# get debug_ms setting and strip it, painfully for reuse
|
2014-07-30 21:48:28 +00:00
|
|
|
old_ms=$(${CEPH} daemon mon.a config get debug_ms | \
|
|
|
|
grep debug_ms | sed -e 's/.*: //' -e 's/["\}\\]//g')
|
|
|
|
${CEPH} daemon mon.a config set debug_ms 13
|
|
|
|
new_ms=$(${CEPH} daemon mon.a config get debug_ms | \
|
|
|
|
grep debug_ms | sed -e 's/.*: //' -e 's/["\}\\]//g')
|
2013-07-31 06:04:41 +00:00
|
|
|
[ "$new_ms" = "13/13" ]
|
2014-07-30 21:48:28 +00:00
|
|
|
${CEPH} daemon mon.a config set debug_ms $old_ms
|
|
|
|
new_ms=$(${CEPH} daemon mon.a config get debug_ms | \
|
|
|
|
grep debug_ms | sed -e 's/.*: //' -e 's/["\}\\]//g')
|
2013-07-31 06:04:41 +00:00
|
|
|
[ "$new_ms" = "$old_ms" ]
|
|
|
|
|
2013-08-04 22:24:49 +00:00
|
|
|
# unregistered/non-existent command
|
2014-07-30 21:48:28 +00:00
|
|
|
expect_false ${CEPH} daemon mon.a bogus_command_blah foo
|
2013-08-04 22:24:49 +00:00
|
|
|
|
2014-07-30 21:50:37 +00:00
|
|
|
set +e
|
|
|
|
OUTPUT=$(${CEPH} -c /not/a/ceph.conf daemon mon.a help 2>&1)
|
|
|
|
# look for EINVAL
|
|
|
|
if [ $? != 22 ] ; then exit 1; fi
|
|
|
|
if ! echo "$OUTPUT" | grep -q '.*open.*/not/a/ceph.conf'; then
|
|
|
|
echo "didn't find expected error in bad conf search"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
set -e
|
|
|
|
|
2013-07-31 06:04:41 +00:00
|
|
|
echo OK
|