diff options
author | Frantisek Sumsal <frantisek@sumsal.cz> | 2023-11-09 00:00:27 +0100 |
---|---|---|
committer | Frantisek Sumsal <frantisek@sumsal.cz> | 2023-11-09 00:00:27 +0100 |
commit | 730ccf968142c4125e30d0bdb6ae73428e2ef4aa (patch) | |
tree | 4d67e088324e000a8dfe3819b7899bd7da6906fa /test | |
parent | busctl: send READY=1 when we become a monitor (diff) | |
download | systemd-730ccf968142c4125e30d0bdb6ae73428e2ef4aa.tar.xz systemd-730ccf968142c4125e30d0bdb6ae73428e2ef4aa.zip |
test: use Type=notify together with `busctl monitor`
Let's use the newly gained feature of `busctl` and start is as a
Type=notify unit, which should make sure the unit is started only after
`busctl` is on the bus listening for messages.
This should help with a race spotted in CIs, where we continued too
early after starting `busctl monitor` and miss the emitted signals:
[ 10.914831] testsuite-45.sh[694]: + systemd-run --unit busctl-monitor.service --service-type=exec busctl monitor --json=short '--match=type='\''signal'\'',sender=org.freedesktop.timesync1,member='\''PropertiesChanged'\'',path=/org/free>
[ 11.064365] systemd[1]: Starting busctl-monitor.service...
[ 11.064903] systemd[1]: Started busctl-monitor.service.
[ 11.065192] testsuite-45.sh[740]: Running as unit: busctl-monitor.service; invocation ID: ee44a9d713c34b9a97e3e7f6f4fffe77
...
[ 11.069255] testsuite-45.sh[694]: + timedatectl ntp-servers ntp99 10.0.0.1
[ 11.077140] systemd-timesyncd[728]: Network configuration changed, trying to establish connection.
[ 11.077461] testsuite-45.sh[694]: + assert_networkd_ntp ntp99 10.0.0.1
...
[ 11.087418] testsuite-45.sh[694]: + assert_timesyncd_signal '2023-11-08 16:28:48.861455' LinkNTPServers 10.0.0.1
...
[ 11.095543] testsuite-45.sh[694]: + for _ in {0..9}
[ 11.095543] testsuite-45.sh[694]: + journalctl -q '--since=2023-11-08 16:28:48.861455' -p info _SYSTEMD_UNIT=busctl-monitor.service --grep .
[ 11.193258] systemd-journald[375]: Received client request to sync journal.
[ 11.112424] testsuite-45.sh[694]: + sleep .5
[ 11.160318] dbus-daemon[465]: [system] Connection :1.56 (uid=0 pid=741 comm="/usr/bin/busctl monitor --json=short --match=type=") became a monitor.
Resolves: #29923
Diffstat (limited to 'test')
-rwxr-xr-x | test/units/testsuite-45.sh | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/units/testsuite-45.sh b/test/units/testsuite-45.sh index 015a56cec6..9d30d6cd8b 100755 --- a/test/units/testsuite-45.sh +++ b/test/units/testsuite-45.sh @@ -263,7 +263,7 @@ EOF systemctl daemon-reload fi - systemd-run --unit busctl-monitor.service --service-type=exec \ + systemd-run --unit busctl-monitor.service --service-type=notify \ busctl monitor --json=short --match="type=signal,sender=org.freedesktop.timedate1,member=PropertiesChanged,path=/org/freedesktop/timedate1" : 'Disable NTP' @@ -357,7 +357,7 @@ EOF systemctl restart systemd-networkd networkctl status ntp99 - systemd-run --unit busctl-monitor.service --service-type=exec \ + systemd-run --unit busctl-monitor.service --service-type=notify \ busctl monitor --json=short --match="type=signal,sender=org.freedesktop.timesync1,member=PropertiesChanged,path=/org/freedesktop/timesync1" # LinkNTPServers |