Skip to content
Snippets Groups Projects
Unverified Commit bec19c49 authored by Roman Azarenko's avatar Roman Azarenko
Browse files

CI: split supervisord config depending on job, make all shell scripts strict

Functional testing (both regular and API) relies on starting some services through supervisord. The set of services,
however, is different between regular and API functional testing.

For instance, functional testing does *not* expect `wifimngr` to run through supervisord, but instead executes it
separately. API test, on the other hand, expects supervisord to start `wifimngr`. The supervisord configuration file,
however, was the same for both instances.

At the time when regular functional test reloads supervisord configuration, the `wifimngr` executable hasn't been
compiled yet, and supervisord reports the following:

	ubusd: added process group
	wifimngr: added process group
	ubusd                            RUNNING   pid 285, uptime 0:00:03
	wifimngr                         FATAL     Exited too quickly (process log may have details)

The supervisord log file then contains this:

	valgrind: /builds/iopsys/wifimngr/wifimngr: No such file or directory

which is expected, since `wifimngr` hasn't been compiled yet.

* In supervisord v3.x, the abovementioned fatal error still results in a zero return code of `supervisorctl status all`.
The error thus goes unnoticed, and the pipeline continues.
* In supervisord v4.x, `supervisorctl status` correctly exits with a non-zero exit code, thus interrupting the script
and failing the pipeline.

The solution here is to have dedicated configuration for regular and API functional testing, where regular functional
testing doesn't use supervisord to manage wifimngr. There are multiple ways to approach this (two complete configs,
config per process etc). I picked two complete configs for simplicity, but this can be changed later.
parent f5701581
No related branches found
No related tags found
1 merge request!91CI: split supervisord config depending on job, make all shell scripts strict
Pipeline #66600 passed
#!/bin/bash #!/bin/bash
set -e set -euxo pipefail
echo "Functional API Tests" echo "Functional API Tests"
pwd pwd
make coverage -C ./ make coverage -C ./
supervisorctl status all supervisorctl status all
cp -a gitlab-ci/supervisord-functional-api.conf /etc/supervisor/conf.d/
supervisorctl reload supervisorctl reload
i=0 i=0
while test $i -le 100 while test $i -le 100
do do
supervisorctl status wifimngr | grep RUNNING && break if supervisorctl status wifimngr | grep RUNNING; then
break
fi
echo "." echo "."
sleep 2 sleep 2
i=$((i+1)) i=$((i+1))
...@@ -22,7 +25,7 @@ supervisorctl status all ...@@ -22,7 +25,7 @@ supervisorctl status all
ubus-api-validator -d ./test/api/json/ > ./api-result.log ubus-api-validator -d ./test/api/json/ > ./api-result.log
supervisorctl stop all supervisorctl stop all
supervisorctl status supervisorctl status || true
#report part #report part
gcovr -r . --xml -o ./api-test-coverage.xml gcovr -r . --xml -o ./api-test-coverage.xml
......
#!/bin/bash #!/bin/bash
set -e set -euxo pipefail
echo "Functional Tests" echo "Functional Tests"
pwd pwd
supervisorctl status all supervisorctl status all
cp -a gitlab-ci/supervisord-functional.conf /etc/supervisor/conf.d/
supervisorctl update supervisorctl update
sleep 3 sleep 3
supervisorctl status all supervisorctl status all
...@@ -12,7 +13,7 @@ supervisorctl status all ...@@ -12,7 +13,7 @@ supervisorctl status all
make functional-test -C ./ make functional-test -C ./
supervisorctl stop all supervisorctl stop all
supervisorctl status supervisorctl status || true
#report part #report part
#GitLab-CI output #GitLab-CI output
......
#!/bin/bash #!/bin/bash
set -euxo pipefail
echo "install dependencies" echo "install dependencies"
pwd pwd
......
#!/bin/bash #!/bin/bash
set -euxo pipefail
echo "preparation script" echo "preparation script"
pwd pwd
cp -r ./test/files/etc/* /etc/ cp -r ./test/files/etc/* /etc/
cp -r ./schemas/ubus/* /usr/share/rpcd/schemas cp -r ./schemas/ubus/* /usr/share/rpcd/schemas
cp ./gitlab-ci/iopsys-supervisord.conf /etc/supervisor/conf.d/
ls /etc/config/ ls /etc/config/
ls /usr/share/rpcd/schemas/ ls /usr/share/rpcd/schemas/
ls /etc/supervisor/conf.d/
[program:ubusd]
priority=1
autorestart=false
startretries=0
command=/bin/bash -c "/usr/sbin/ubusd"
[supervisord]
priority=3
autorestart=false
startretries=0
environment = LIBWIFI_DEBUG_LEVEL=7
logfile=%(ENV_SUPERVISOR_LOG)s
loglevel=debug
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment