Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / test / test_subman.sh
1 #!/bin/bash -e
2
3 source $(dirname $0)/detect-build-env-vars.sh
4
5 TMP=$(mktemp -d)
6 trap "rm -fr $TMP" EXIT
7
8 export PATH=$TMP:$PATH
9
10 cat > $TMP/ceph-disk <<EOF
11 echo '[{"partition":[{"type":"data","path":"/dev/foo/bar"}]}]'
12 EOF
13 chmod +x $TMP/ceph-disk
14
15 cat > $TMP/df <<EOF
16 echo Used
17 echo $((2 * 1024 * 1024 * 1024))
18 EOF
19 chmod +x $TMP/df
20
21 cat > $TMP/expected <<EOF
22 {
23 "band.storage.usage": 2
24 }
25 EOF
26 export CEPH_FACTS_FILE=$TMP/facts
27 $CEPH_ROOT/src/script/subman
28 diff -u $CEPH_FACTS_FILE $TMP/expected