]> git.proxmox.com Git - ceph.git/blame - ceph/qa/workunits/cephtool/test_daemon.sh
import ceph quincy 17.2.1
[ceph.git] / ceph / qa / workunits / cephtool / test_daemon.sh
CommitLineData
11fdf7f2 1#!/usr/bin/env bash
7c673cae 2
11fdf7f2 3set -ex
7c673cae
FG
4
5expect_false()
6{
7 set -x
8 if "$@"; then return 1; else return 0; fi
9}
10
11echo note: assuming mon.a is on the current host
12
13# can set to 'sudo ./ceph' to execute tests from current dir for development
14CEPH=${CEPH:-'sudo ceph'}
15
16${CEPH} daemon mon.a version | grep version
17
18# get debug_ms setting and strip it, painfully for reuse
19old_ms=$(${CEPH} daemon mon.a config get debug_ms | \
20 grep debug_ms | sed -e 's/.*: //' -e 's/["\}\\]//g')
21${CEPH} daemon mon.a config set debug_ms 13
22new_ms=$(${CEPH} daemon mon.a config get debug_ms | \
23 grep debug_ms | sed -e 's/.*: //' -e 's/["\}\\]//g')
24[ "$new_ms" = "13/13" ]
25${CEPH} daemon mon.a config set debug_ms $old_ms
26new_ms=$(${CEPH} daemon mon.a config get debug_ms | \
27 grep debug_ms | sed -e 's/.*: //' -e 's/["\}\\]//g')
28[ "$new_ms" = "$old_ms" ]
29
30# unregistered/non-existent command
31expect_false ${CEPH} daemon mon.a bogus_command_blah foo
32
33set +e
34OUTPUT=$(${CEPH} -c /not/a/ceph.conf daemon mon.a help 2>&1)
35# look for EINVAL
36if [ $? != 22 ] ; then exit 1; fi
37if ! echo "$OUTPUT" | grep -q '.*open.*/not/a/ceph.conf'; then
38 echo "didn't find expected error in bad conf search"
39 exit 1
40fi
41set -e
42
43echo OK