make shell tests and shell scripts more robust
Mainly I would like to add set -eu
on all shell scripts so that they don't fail silently i.e. with a success error code e.g. like they did in ut-basic#119.
[2020-11-23T02:06:45.668Z] Executing kea-shell (echo | /home/jenkins/workspace/kea-dev/ut-basic/src/bin/shell/kea-shell --host 127.0.0.1 --port 8081 --auth-user pet --auth-password meow list-commands > /home/jenkins/workspace/kea-dev/ut-basic/src/bin/shell/tests/shell-stdout.txt)
[2020-11-23T02:06:45.668Z] sh: fail: unknown operand
For the same test shell_process_tests.sh
, on my computer, it runs in bash since it's missing a shebang so I get a different error:
Executing kea-shell (echo | /home/andrei/work/isc/kea/src/bin/shell/kea-shell --host 127.0.0.1 --port 8081 --auth-user pet --auth-password meow list-commands > /home/andrei/work/isc/kea/src/bin/shell/tests/shell-stdout.txt)
/home/andrei/work/isc/kea/src/bin/shell/tests/basic_auth_tests.sh: line 119: [: ==: unary operator expected
Regardless, the test passes even though there is an undefiend variable there.
Adding a #!/bin/sh
shebang to all scripts is another action I would like to take.
And adding all scripts to Gitlab CI.
And so on...