]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
test: cephtool/test.sh: fix expect_false with pipe 10133/head
authorKefu Chai <kchai@redhat.com>
Tue, 5 Jul 2016 06:15:41 +0000 (14:15 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 5 Jul 2016 07:26:43 +0000 (15:26 +0800)
commit5e16f2379d8d1f5d1cff3d7a58031d54c9413ea5
treeca09f2d1513bf9e182744da782a395b9dd04ef4c
parent5485296a3da76259abf44c6a44a0d698ca8cb185
test: cephtool/test.sh: fix expect_false with pipe

this fixes failures like,

/home/jenkins-build/build/workspace/ceph-pull-requests/qa/workunits/cephtool/test.sh:
line 32: ceph osd blacklist ls | grep 192.168.0.1: command not found

where the failure is not the "failure" we are expecting.

in our tests, following command

expect_false "ceph osd blacklist ls | grep 192.168.0.1"

is designed to to verify that "ceph osd blacklist ls | grep 192.168.0.1"
fails with non-zero return code. but expect_false() evaluates the command
line using plain "$@", which will send the arguments direct to the shell,
and $0 is "ceph auth get client.xx | grep caps | grep mon", which does
not exist and is not built-in command. so we need to check the grep
command instead.

for multiple piped command line, use

expect_false sh <<< "echo foo  | grep bar | grep baz"

Signed-off-by: Kefu Chai <kchai@redhat.com>
qa/workunits/cephtool/test.sh