tests: Run timeLimitsManager tests in UTC
In order to keep the test code brief, all expected times and dates are written as ISO 8601 strings in the test code, and use `Z` to specify UTC (again, to keep things brief). If the test is run under a significantly different timezone, the end-of-day timestamp changes significantly, as it’s calculated by the code-under-test using the local timezone. Avoid that issue by requiring the `timeLimitsManager` tests to always be run in UTC. The previous failure could be reproduced by running `TZ=Europe/Madrid meson test -C /opt/gnome/build/gnome-shell timeLimitsManager --verbose` — the test for “tracks a single day’s usage early in the morning” would fail. Signed-off-by: Philip Withnall <pwithnall@gnome.org> Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3605>
This commit is contained in:

committed by
Marge Bot

parent
72cb52e743
commit
a3d4198c85
@ -35,6 +35,14 @@ unit_tests = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
foreach test : unit_tests
|
foreach test : unit_tests
|
||||||
|
local_test_env = unit_testenv
|
||||||
|
|
||||||
|
# The time limits tests hard-code UTC to keep the code brief, so must be run
|
||||||
|
# in UTC
|
||||||
|
if test == 'timeLimitsManager'
|
||||||
|
local_test_env.set('TZ', 'UTC')
|
||||||
|
endif
|
||||||
|
|
||||||
test(test, jasmine,
|
test(test, jasmine,
|
||||||
args: [
|
args: [
|
||||||
'--module',
|
'--module',
|
||||||
@ -44,7 +52,7 @@ foreach test : unit_tests
|
|||||||
'unit/@0@.js'.format(test),
|
'unit/@0@.js'.format(test),
|
||||||
],
|
],
|
||||||
suite: 'unit',
|
suite: 'unit',
|
||||||
env: unit_testenv,
|
env: local_test_env,
|
||||||
protocol: 'tap',
|
protocol: 'tap',
|
||||||
workdir: meson.current_source_dir())
|
workdir: meson.current_source_dir())
|
||||||
endforeach
|
endforeach
|
||||||
|
Reference in New Issue
Block a user