Commit graph

19 commits

Author SHA1 Message Date
Frantisek Sumsal 730ccf9681 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
2023-11-09 00:00:27 +01:00
Frantisek Sumsal 9a42457bae test: drop some unnecessary quotes 2023-11-08 23:38:28 +01:00
Frantisek Sumsal 4e55082f74 test: retry the property check a couple of times
41e4ce06fe shortened existing sleeps, which resulted in the check being
sometimes done before the property had a chance to update. Let's do what
what we do with the rest of the checks and retry it a couple of times.

Resolves: #29923
2023-11-08 10:03:53 +00:00
Yu Watanabe c62345ffc7 tree-wide: fix typo 2023-11-08 14:57:33 +09:00
Frantisek Sumsal 9521574cd4 timesync: fix PropertiesChanges signals for NTP properties
As in their current form they didn't work at all:

systemd-timesyncd[190115]: Assertion 's' failed at src/libsystemd/sd-event/sd-event.c:3058, function sd_event_source_set_enabled(). Ignoring.
systemd-timesyncd[190115]: Failed to reenable system ntp server change event source!
systemd-timesyncd[190115]: Failed to enable ntp server defer event, ignoring: Invalid argument

This was also pointed out in the post-merge review [0].

Let's address this together with the rest of the comments, and add
some tests to make sure everything works as it should.

Resolves: #28770
Follow-up to: 8f1c446

[0] 8f1c446979 (r124147466)
2023-11-07 21:36:59 +01:00
Frantisek Sumsal 41e4ce06fe test: "prettify" the test a bit 2023-11-07 21:36:59 +01:00
Frantisek Sumsal 07268394d6 test: unify /testok & /failed handling
And drop it where not necessary.
2023-07-12 16:03:40 +02:00
Frantisek Sumsal 7234a2131b test: use run_testcases() in a few more places 2023-05-22 16:02:49 +02:00
Frantisek Sumsal cb153b4fe9 test: rename assert.sh to util.sh
So we can extend it with additional utility functions without making it
confusing.

No functional change.
2023-05-16 22:43:52 +02:00
Zbigniew Jędrzejewski-Szmek 4481a30855 test: use idiomatic bash loop iteration
In a few cases, also avoid a sleep in the last (failed) iteration of the loop.
It doesn't matter too much, but it's still ugly.
2023-04-24 21:59:28 +02:00
Frantisek Sumsal a51ba8e31a test: add a couple of basic sanity tests for timedatectl 2023-04-16 09:21:13 +02:00
Zbigniew Jędrzejewski-Szmek 7a17e41dcf test: drop whitespace after shell redirection operators
(The one case that is left unchanged is '< <(subcommand)'.)

This way, the style with no gap was already dominant. This way, the reader
immediately knows that ' < ' is a comparison operator and ' << ' is a shift.

In a few cases, replace custom EOF replacement by just EOF. There is no point
in using someting like "_EOL" unless "EOF" appears in the text.
2023-02-06 09:19:04 +01:00
Yu Watanabe 59ab79a73d test: support non-summer time
Follow-up for 759ed0a253.
2022-10-30 08:26:00 +00:00
Yu Watanabe 6243063824 test: use trap RETURN 2022-06-14 21:08:04 +09:00
Yu Watanabe 2f34ee3329 test: insert space in for loop 2022-06-14 21:05:10 +09:00
Yu Watanabe aab61a8c99 test: support debian/ubuntu specific timezone config file 2022-06-14 20:52:44 +09:00
Yu Watanabe 8ed2103306 test: drop unnecessary --no-pager option 2022-06-14 20:52:44 +09:00
Yu Watanabe d170b47535 test: introduce assert_not_in() helper function
This also silence assertions, and replace grep with bash's regular
expression match.
2022-06-14 20:52:38 +09:00
Yu Watanabe 759ed0a253 test: import timedated test from debian/ubuntu test suite 2022-06-10 16:04:52 +09:00