/
entrypoint.sh
executable file
·148 lines (136 loc) · 4.26 KB
/
entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#!/bin/bash -x
function usage {
cat <<EOF
Usage: $0 [OPTIONS]
Run contrail-test in container
-h Print help
-t Testbed file, Default: /opt/contrail/utils/fabfile/testbeds/testbed.py
-p contrail fab utils path. Default: /opt/contrail/utils
-f features to test. Default: sanity
Valid options:
sanity, quick_sanity, ci_sanity, ci_sanity_WIP, ci_svc_sanity,
upgrade, webui_sanity, ci_webui_sanity, devstack_sanity, upgrade_only
-T test tags to run tests. If not provided, try $TEST_TAGS variable
-l path where contrail-test can be found. Default: /contrail-test
EOF
}
while getopts ":T:t:p:f:h" opt; do
case $opt in
h)
usage
exit
;;
t)
testbed_input=$OPTARG
;;
p)
contrail_fabpath_input=$OPTARG
;;
f)
feature_input=$OPTARG
;;
T)
test_tags=$OPTARG
;;
l)
contrail_test_folder=$OPTARG
;;
:)
echo "Option -$OPTARG requires an argument." >&2
exit 1
;;
esac
done
TESTBED=${testbed_input:-${TESTBED:-'/opt/contrail/utils/fabfile/testbeds/testbed.py'}}
CONTRAIL_FABPATH=${contrail_fabpath_input:-${CONTRAIL_FABPATH:-'/opt/contrail/utils'}}
CONTRAIL_TEST_FOLDER=${contrail_test_folder:-${CONTRAIL_TEST_FOLDER:-'/contrail-test'}}
FEATURE=${feature_input:-${FEATURE:-'sanity'}}
TEST_TAGS=${test_tags:-$TEST_TAGS}
if [[ ! -f ${CONTRAIL_TEST_FOLDER}/contrail_test_input.yaml && ! -f $TESTBED ]]; then
echo "ERROR! Either testbed file or yaml file under /contrail-test is required.
you probably forgot to attach them as volumes"
exit 100
fi
if [ ! $TESTBED -ef ${CONTRAIL_FABPATH}/fabfile/testbeds/testbed.py ]; then
mkdir -p ${CONTRAIL_FABPATH}/fabfile/testbeds/
cp $TESTBED ${CONTRAIL_FABPATH}/fabfile/testbeds/testbed.py
fi
cd ${CONTRAIL_TEST_FOLDER}
run_tests="./run_tests.sh --contrail-fab-path $CONTRAIL_FABPATH "
if [[ -n $TEST_RUN_CMD ]]; then
$TEST_RUN_CMD $EXTRA_RUN_TEST_ARGS
rv_run_test=$?
elif [[ -n $TEST_TAGS ]]; then
$run_tests -T $TEST_TAGS $EXTRA_RUN_TEST_ARGS
rv_run_test=$?
else
case $FEATURE in
sanity)
$run_tests --sanity --send-mail -U -t $EXTRA_RUN_TEST_ARGS
rv_run_test=$?
;;
k8s_sanity)
$run_tests -T k8s_sanity --send-mail -U -t $EXTRA_RUN_TEST_ARGS
rv_run_test=$?
;;
openshift)
$run_tests -T openshift_1 --send-mail -U -t $EXTRA_RUN_TEST_ARGS
rv_run_test=$?
;;
ci_k8s_sanity)
$run_tests -T ci_k8s_sanity --send-mail -U -t $EXTRA_RUN_TEST_ARGS
rv_run_test=$?
;;
vcenter)
$run_tests -T vcenter --send-mail -U -t $EXTRA_RUN_TEST_ARGS
rv_run_test=$?
;;
quick_sanity)
$run_tests -T quick_sanity --send-mail -t $EXTRA_RUN_TEST_ARGS
rv_run_test=$?
;;
ci_sanity)
export ci_image=${CI_IMAGE:-'cirros'}
$run_tests -T ci_sanity --send-mail -U $EXTRA_RUN_TEST_ARGS
rv_run_test=$?
;;
ci_sanity_WIP)
export ci_image=${CI_IMAGE:-'cirros'}
$run_tests -T ci_sanity_WIP --send-mail -U $EXTRA_RUN_TEST_ARGS
rv_run_test=$?
;;
ci_svc_sanity)
python ci_svc_sanity_suite.py
rv_run_test=$?
;;
upgrade)
$run_tests -T upgrade --send-mail -U $EXTRA_RUN_TEST_ARGS
rv_run_test=$?
;;
webui_sanity)
python webui_tests_suite.py
rv_run_test=$?
;;
ci_webui_sanity)
python ci_webui_sanity.py
rv_run_test=$?
;;
devstack_sanity)
python devstack_sanity_tests_with_setup.py
rv_run_test=$?
;;
upgrade_only)
python upgrade/upgrade_only.py
rv_run_test=$?
;;
*)
echo "Unknown FEATURE - ${FEATURE}"
exit 1
;;
esac
fi
if [ -d ${CONTRAIL_TEST_FOLDER}.save ]; then
cp -f ${CONTRAIL_FABPATH}/fabfile/testbeds/testbed.py ${CONTRAIL_TEST_FOLDER}.save/
rsync -L -a --exclude logs/ --exclude report/ ${CONTRAIL_TEST_FOLDER} ${CONTRAIL_TEST_FOLDER}.save/
fi
exit $rv_run_test