Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / test / run-rbd-tests
1 #!/bin/bash -ex
2
3 # this should be run from the src directory in the ceph.git
4
5 source $(dirname $0)/detect-build-env-vars.sh
6 CEPH_SRC=$CEPH_ROOT/src
7 if [ -e CMakeCache.txt ]; then
8     CYTHON_MODULES_DIR=$CEPH_LIB/cython_modules
9 else
10     CYTHON_MODULES_DIR=$CEPH_SRC/build
11 fi
12
13 export PYTHONPATH="$CEPH_SRC/pybind:$CEPH_SRC/test/pybind"
14 for x in $CYTHON_MODULES_DIR/lib* ; do
15     PYTHONPATH="${PYTHONPATH}:${x}"
16 done
17
18 recreate_pool() {
19     POOL_NAME=$1
20     PG_NUM=100
21     ceph osd pool delete $POOL_NAME $POOL_NAME --yes-i-really-really-mean-it
22     ceph osd pool create $POOL_NAME $PG_NUM
23 }
24
25 run_cli_tests() {
26     recreate_pool rbd
27     $CEPH_SRC/../qa/workunits/rbd/import_export.sh
28     recreate_pool rbd
29     $CEPH_SRC/../qa/workunits/rbd/cli_generic.sh
30     recreate_pool rbd
31     $CEPH_SRC/../qa/workunits/rbd/journal.sh
32 }
33
34 # tests that do not depend on image format / features
35 run_generic_tests() {
36     $CEPH_SRC/../qa/workunits/rbd/verify_pool.sh
37
38     recreate_pool rbd
39     $CEPH_SRC/../qa/workunits/rbd/journal.sh
40     recreate_pool rbd
41     $CEPH_SRC/../qa/workunits/rbd/test_admin_socket.sh
42 }
43
44 run_api_tests() {
45     # skip many_snaps since it takes several minutes
46     nosetests -v test_rbd -e '.*many_snaps'
47     # ceph_test_librbd creates its own pools
48     ceph_test_librbd
49 }
50
51 ceph_test_cls_rbd
52 run_generic_tests
53 run_api_tests
54 run_cli_tests
55
56 export RBD_CREATE_ARGS="--image-format 2"
57 run_cli_tests
58
59 for i in 0 1 61 109
60 do
61     export RBD_FEATURES=$i
62     run_api_tests
63 done
64
65 echo OK