Skip to content

Commit

Permalink
tests/main/snap-set-core-config: fix use of MATCH -v
Browse files Browse the repository at this point in the history
Use of MATCH -v is often incorrect since it returns 0 when there are lines not
matching the pattern in the input.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
  • Loading branch information
bboozzoo committed Dec 18, 2019
1 parent 34d78b5 commit a17652f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/main/snap-set-core-config/task.yaml
Expand Up @@ -4,7 +4,11 @@ summary: Ensure "snap set core" works
systems: [ubuntu-core-*]

prepare: |
if systemctl -l | MATCH -v rsyslog.service; then
rc=0
systemctl status rsyslog.service || rc=$?
if [ $rc = 4 ]; then
# systemctl(1) exit code 4: no such unit
#shellcheck source=tests/lib/systemd.sh
. "$TESTSLIB"/systemd.sh
Expand Down

0 comments on commit a17652f

Please sign in to comment.