Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Relax boot timer check in TestServices.testTimerSession #19522

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions test/verify/check-system-services
Original file line number Diff line number Diff line change
Expand Up @@ -590,11 +590,13 @@ WantedBy=default.target
b.wait_visible(self.svc_sel('test-onboot.timer'))
b.wait_text(self.svc_sel('test-onboot.timer') + ' .service-unit-triggers', '')
self.run_systemctl(user, "start test-onboot.timer")
# Check the next run. Since it triggers 200mins after the boot, it might be today or tomorrow (after 20:40)
today_stamp = int(m.execute("date +%s").strip())
time_zone = b.eval_js("Intl.DateTimeFormat().resolvedOptions().timeZone") # get browser's time zone
today_plus_200min = m.execute(f"TZ='{time_zone}' date --date=@{today_stamp + 200 * 60} '+%b %-d, %Y'").strip()
b.wait_in_text(self.svc_sel('test-onboot.timer') + ' .service-unit-next-trigger', today_plus_200min)
# Check the next run. Since it triggers 200mins after the boot, it might be today or tomorrow
# this is too racy to predict accurately
today = m.execute("date '+%b %-d, %Y'").strip()
tomorrow = m.execute("date --date tomorrow '+%b %-d, %Y'").strip()
sel_next = self.svc_sel('test-onboot.timer') + ' .service-unit-next-trigger'
b.wait_in_text(sel_next, ", ")
self.assertRegex(b.text(sel_next), f"{today}|{tomorrow}")
b.wait_in_text(self.svc_sel('test-onboot.timer') + ' .service-unit-last-trigger', "unknown") # last trigger
self.run_systemctl(user, "stop test-onboot.timer")

Expand Down