11# set -x
22set -e
3+
4+ # Enabling verbose is useful for debugging but the commander command seems to
5+ # return exit code of 0 when verbose is enabled, even if tests fails. So verbose
6+ # is disabled by default.
7+ # export CL_TEST_VERBOSE="--verbose"
8+
39cd $CL_HOME
10+
11+ # Setup app specs
12+ rm -rf appspecs_bk
13+ if [[ -d internal/server/appspecs/dummy ]]; then
14+ mv internal/server/appspecs appspecs_bk
15+ cp -r config/appspecs internal/server/
16+ fi
417go build ./cmd/clace
18+
519cd tests
620rm -rf clace.db
721
822export CL_HOME=.
923unset CL_CONFIG_FILE
1024unset SSH_AUTH_SOCK
1125
12- # Enabling verbose is useful for debugging but the commander command seems to
13- # return exit code of 0 when verbose is enabled, even if tests fails. So verbose
14- # is disabled by default.
15- # export CL_TEST_VERBOSE="--verbose"
16-
1726trap " error_handler" ERR
1827
1928error_handler () {
@@ -25,7 +34,13 @@ error_handler () {
2534
2635cleanup () {
2736 rm -rf clace.db
28- rm -rf logs/ clace.toml server.stdout
37+ rm -rf logs/ clace.toml config_container.toml server.stdout flaskapp
38+
39+ if [[ -d ../appspecs_bk ]]; then
40+ rm -rf ../internal/server/appspecs
41+ mv ../appspecs_bk ../internal/server/appspecs
42+ fi
43+
2944 set +e
3045 ps -ax | grep " clace server start" | grep -v grep | cut -c1-6 | xargs kill -9
3146
@@ -136,5 +151,37 @@ if [[ -n "$CL_GITHUB_SECRET" ]]; then
136151 commander test $CL_TEST_VERBOSE test_oauth.yaml
137152fi
138153
154+ if [[ $CL_CONTAINER_COMMANDS = " disable" ]]; then
155+ CL_CONTAINER_COMMANDS=" "
156+ elif [[ -z " $CL_CONTAINER_COMMANDS " ]]; then
157+ CL_CONTAINER_COMMANDS=" docker podman"
158+ fi
159+
160+ port_base=9000
161+
162+ for cmd in ${CL_CONTAINER_COMMANDS} ; do
163+ http_port=` expr $port_base + 1`
164+ https_port=` expr $port_base + 2`
165+ port_base=` expr $port_base + 2`
166+
167+ # Use password hash for "abcd"
168+ cat << EOF > config_container.toml
169+ [http]
170+ port = $http_port
171+ [https]
172+ port = $https_port
173+ [security]
174+ app_default_auth_type="none"
175+ EOF
176+ rm -rf clace.db* run/clace.sock
177+ CL_CONFIG_FILE=config_container.toml ../clace server start &
178+ sleep 2
179+
180+ export CL_CONTAINER_CMD=$cmd
181+ export HTTP_PORT=$http_port
182+ echo " ********Testing container apps for $cmd *********"
183+ commander test $CL_TEST_VERBOSE test_containers.yaml
184+ done
185+
139186cleanup
140187echo " All tests passed"
0 commit comments