]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: set ncat's idle timeout as well
authorFrantisek Sumsal <frantisek@sumsal.cz>
Tue, 5 Sep 2023 11:30:12 +0000 (13:30 +0200)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Tue, 5 Sep 2023 11:30:12 +0000 (13:30 +0200)
Otherwise we'll get stuck waiting indefinitely if the test socket unit
fails to fail due the trigger limit, i.e.:

[  111.104906] testsuite-07.sh[743]: + systemctl start issue2467.socket
[  OK  ] Listening on issue2467.socket.
[  111.746465] testsuite-07.sh[743]: + nc -w20 -U /run/test.ctl
         Starting systemd-tmpfiles-clean.service...
[  OK  ] Finished systemd-tmpfiles-clean.service.
qemu-system-x86_64: terminating on signal 15 from pid 565814 (timeout)
E: Test timed out after 1800s

With the idle timeout we should give up after 20 seconds, allowing the next
statement to properly fail:

[   34.233084] testsuite-07.sh[450]: + systemctl start issue2467.socket
[   35.475392] testsuite-07.sh[450]: + nc -i20 -w20 -U /run/test.ctl
[   56.122941] testsuite-07.sh[458]: Ncat: Idle timeout expired (20000 ms).
[   56.140871] testsuite-07.sh[450]: + :
[   56.145460] testsuite-07.sh[450]: + timeout 10 bash -c 'while ! [[ "$(systemctl show issue2467.socket -P ActiveState)" == failed ]]; do sleep .5; done'
[   66.197623] testsuite-07.sh[446]: + echo 'Subtest /usr/lib/systemd/tests/testdata/units/testsuite-07.issue-2467.sh failed'

test/units/testsuite-07.issue-2467.sh

index a5dcfd55dd958e722e8df8a5eb988757bce9c7f3..0d8c16e65a2a3826d98f736ababf37ec018aab22 100755 (executable)
@@ -8,7 +8,7 @@ set -o pipefail
 
 rm -f /tmp/nonexistent
 systemctl start issue2467.socket
-nc -w20 -U /run/test.ctl || :
+nc -i20 -w20 -U /run/test.ctl || :
 
 # TriggerLimitIntervalSec= by default is set to 2s. A "sleep 10" should give
 # systemd enough time even on slower machines, to reach the trigger limit.