3232shift $(( $OPTIND - 1 ))
3333
3434# # Script to install samples, tests, and run all workflows in tests pack.
35+ if [[ ` id -u` != 0 ]]; then
36+ echo " st2-self-check must be run as root"
37+ exit 1
38+ fi
39+
3540ERRORS=0
3641PACKS=" tests examples"
3742
38- # Determine Distro
39- DEBTEST=` lsb_release -a 2> /dev/null | grep Distributor | awk ' {print $3}' `
40-
41- if [[ " $DEBTEST " == " Ubuntu" ]]; then
42- TYPE=" debs"
43- PYTHONPACK=" /usr/lib/python2.7/dist-packages"
44- elif [[ -f " /etc/redhat-release" ]]; then
45- TYPE=" rpms"
46- PYTHONPACK=" /usr/lib/python2.7/site-packages"
47- else
48- echo " Unknown Operating System"
49- exit 2
50- fi
51-
5243# Determine API HTTP Protocol
5344PROTOCOL=" http"
5445ST2_CLI_CONFIG_FILE=` readlink -f ~ /.st2/config`
@@ -61,36 +52,19 @@ elif [ ! -z ${ST2_BASE_URL+x} ]; then
6152 PROTOCOL=" https"
6253 fi
6354elif [ -e " ${ST2_CLI_CONFIG_FILE} " ]; then
64- if [ ! -z " cat ${ST2_CLI_CONFIG_FILE} | grep -E 'https://(.+):9101'" ]; then
55+ if [ ! " cat ${ST2_CLI_CONFIG_FILE} | grep -E 'https://(.+):9101'" ]; then
6556 PROTOCOL=" https"
66- elif [ ! -z " cat ${ST2_CLI_CONFIG_FILE} | grep -E 'base_url\s?=\s?https'" ]; then
57+ elif [ ! " cat ${ST2_CLI_CONFIG_FILE} | grep -E 'base_url\s?=\s?https'" ]; then
6758 PROTOCOL=" https"
6859 fi
6960fi
7061
71- # Install test prerequisites
72- ${PYTHONPACK} /st2common/bin/st2-setup-tests asserts
73- ${PYTHONPACK} /st2common/bin/st2-setup-tests fixtures
62+ echo -n " Installing asserts,fixtures,tests"
63+ st2 run packs.install subtree=true repo_url=StackStorm/st2tests packs=asserts,fixtures,tests
7464
75- # Install required packs if necessary
76- for PACK in $PACKS ; do
77- CHECK=` st2 action list --pack=${PACK} | grep ${PACK} `
78- if [ $? -ne 0 ]; then
79- if [ " $PACK " == " tests" ]; then
80- ARG=" tests"
81- else
82- ARG=" "
83- fi
84- INSTALL=` ${PYTHONPACK} /st2common/bin/st2-setup-${PACK} ${ARG} `
85-
86- EXITCODE=$?
87- echo $INSTALL
88- if [ ${EXITCODE} -ne 0 ]; then
89- echo " st2-self-check failed. See above."
90- exit 2
91- fi
92- fi
93- done
65+ echo -n " Installing examples"
66+ cp -Rf /usr/share/doc/st2/examples /opt/stackstorm/packs/
67+ st2ctl reload
9468
9569# Retrieve test action list
9670TEST_ACTION_LIST=` st2 action list --pack=tests -w 90 | awk ' { print $2 }' | grep -v " |" | grep -v " ref" `
0 commit comments