]> git.ipfire.org Git - thirdparty/systemd.git/commit
test: make the resolved notifications check a bit more robust 24637/head
authorFrantisek Sumsal <frantisek@sumsal.cz>
Sun, 11 Sep 2022 12:17:56 +0000 (14:17 +0200)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Sun, 11 Sep 2022 12:29:34 +0000 (14:29 +0200)
commite3cccd3c2b214191a7bb1d0313fab95d5bd6e2f2
tree45e2acff0a80e910c39437f33bed37cf1bd4f4fb
parent7906b790e4549d71087a6a94354ba02c2f1b6fa2
test: make the resolved notifications check a bit more robust

Let's parse the resolved JSON notifications via `jq` and check them in a
bit more "controlled" manner - e.g. until now the `grep` was checking just
a one gigantic JSON string, as all received notifications via the
varlink socket are terminated by a NUL character, not a newline.

Also, as the notification delivery is asynchronous, retry the check
a couple of times if it fails (spotted in C8S jobs):

```
[ 2891.935879] testsuite-75.sh[36]: + : '--- nss-resolve/nss-myhostname tests'
[ 2891.935988] testsuite-75.sh[36]: + run getent -s resolve hosts ns1.unsigned.test
[ 2891.936542] testsuite-75.sh[177]: + getent -s resolve hosts ns1.unsigned.test
[ 2891.937499] testsuite-75.sh[178]: + tee /tmp/tmp.pqjNvbQ2eS
[ 2891.939977] testsuite-75.sh[178]: 10.0.0.1        ns1.unsigned.test
[ 2891.940258] testsuite-75.sh[36]: + grep -qE '^10\.0\.0\.1\s+ns1\.unsigned\.test' /tmp/tmp.pqjNvbQ2eS
[ 2891.942235] testsuite-75.sh[189]: + grep -qF '[10,0,0,1]'
[ 2891.942577] testsuite-75.sh[188]: + grep -aF ns1.unsigned.test /tmp/notifications.txt
[ 2891.943978] systemd[1]: testsuite-75.service: Child 36 belongs to testsuite-75.service.
[ 2891.944112] systemd[1]: testsuite-75.service: Main process exited, code=exited, status=1/FAILURE
[ 2891.944215] systemd[1]: testsuite-75.service: Failed with result 'exit-code'.
```
test/units/testsuite-75.sh