mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 00:14:32 +09:00
test: wait for a process ID instead of job ID
Since depending on job control turned out to be flaky [0], let's just
explicitly wait for a process ID instead.
Follow-up for 3849b0701a.
Resolves: #39543
[0] https://github.com/systemd/systemd/issues/39543#issuecomment-3529418583
This commit is contained in:
committed by
Luca Boccassi
parent
09ee7040c8
commit
c3d432a3d2
@@ -71,16 +71,18 @@ assert_eq "$(systemctl show "$UNIT_NAME.socket" -P SubState)" "listening"
|
||||
(! systemctl -q is-active "$UNIT_NAME.service")
|
||||
|
||||
socat -u - UNIX-CONNECT:"/tmp/$UNIT_NAME/test" &
|
||||
PID=$!
|
||||
wait_for_start
|
||||
wait %%
|
||||
wait $PID
|
||||
|
||||
touch "/tmp/$UNIT_NAME/flag"
|
||||
systemctl start "$UNIT_NAME-conflict2.service"
|
||||
wait_for_stop
|
||||
|
||||
socat -u - UNIX-CONNECT:"/tmp/$UNIT_NAME/test" &
|
||||
PID=$!
|
||||
wait_for_start
|
||||
wait %%
|
||||
wait $PID
|
||||
(! systemctl -q is-active "$UNIT_NAME-conflict2.service")
|
||||
|
||||
# DeferTrigger=yes
|
||||
@@ -97,9 +99,10 @@ assert_eq "$(systemctl show "$UNIT_NAME-conflict1.service" -P SubState)" "start"
|
||||
# Wait in "deferred" state
|
||||
|
||||
socat -u - UNIX-CONNECT:"/tmp/$UNIT_NAME/test" &
|
||||
PID=$!
|
||||
timeout 30 bash -c "until [[ \$(systemctl show '$UNIT_NAME.socket' -P SubState) == 'deferred' ]]; do sleep .5; done"
|
||||
(! systemctl -q is-active "$UNIT_NAME.service")
|
||||
wait %%
|
||||
wait $PID
|
||||
assert_eq "$(systemctl show "$UNIT_NAME-conflict1.service" -P SubState)" "start"
|
||||
|
||||
systemctl daemon-reload
|
||||
@@ -120,9 +123,10 @@ systemctl start "$UNIT_NAME-conflict2.service"
|
||||
wait_for_stop
|
||||
|
||||
socat -u - UNIX-CONNECT:"/tmp/$UNIT_NAME/test" &
|
||||
PID=$!
|
||||
timeout 30 bash -c "until [[ \$(systemctl show '$UNIT_NAME.socket' -P SubState) == 'deferred' ]]; do sleep .5; done"
|
||||
(! systemctl -q is-active "$UNIT_NAME.service")
|
||||
wait %%
|
||||
wait $PID
|
||||
|
||||
rm "/tmp/$UNIT_NAME/flag"
|
||||
timeout 30 bash -c "while systemctl -q is-active '$UNIT_NAME-conflict2.service'; do sleep .2; done"
|
||||
@@ -136,9 +140,10 @@ wait_for_stop
|
||||
assert_eq "$(systemctl show "$UNIT_NAME-conflict1.service" -P SubState)" "start"
|
||||
|
||||
socat -u - UNIX-CONNECT:"/tmp/$UNIT_NAME/test" &
|
||||
PID=$!
|
||||
timeout 30 bash -c "until [[ \$(systemctl show '$UNIT_NAME.socket' -P SubState) == 'deferred' ]]; do sleep .5; done"
|
||||
(! systemctl -q is-active "$UNIT_NAME.service")
|
||||
wait %%
|
||||
wait $PID
|
||||
|
||||
echo "DeferTriggerMaxSec=20s" >>/run/systemd/system/"$UNIT_NAME.socket"
|
||||
systemctl daemon-reload
|
||||
|
||||
Reference in New Issue
Block a user