32
32
shift $(( $OPTIND - 1 ))
33
33
34
34
# # 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
+
35
40
ERRORS=0
36
41
PACKS=" tests examples"
37
42
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
-
52
43
# Determine API HTTP Protocol
53
44
PROTOCOL=" http"
54
45
ST2_CLI_CONFIG_FILE=` readlink -f ~ /.st2/config`
@@ -61,36 +52,19 @@ elif [ ! -z ${ST2_BASE_URL+x} ]; then
61
52
PROTOCOL=" https"
62
53
fi
63
54
elif [ -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
65
56
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
67
58
PROTOCOL=" https"
68
59
fi
69
60
fi
70
61
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
74
64
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
94
68
95
69
# Retrieve test action list
96
70
TEST_ACTION_LIST=` st2 action list --pack=tests -w 90 | awk ' { print $2 }' | grep -v " |" | grep -v " ref" `
0 commit comments