From 836ba11b9bc83232ffd8ee91b0a727216aa0861a Mon Sep 17 00:00:00 2001 From: Julia Kreger Date: Tue, 21 Feb 2023 08:38:26 -0800 Subject: [PATCH] Use UTC for the timezone in functional tests The prior code uses the local time zone, in my case prsently 'PST' which pytz doesn't grok, however it does grok UTC, and CI runs in UTC, and the API, as far as I know, conveys in UTC. So this should just be for consistency. Change-Id: Ia47b6adfc18be54f8e9623b34ef34b66436828dc --- ironic_inspector/test/functional.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ironic_inspector/test/functional.py b/ironic_inspector/test/functional.py index fadb3efdc..5bd6724b3 100644 --- a/ironic_inspector/test/functional.py +++ b/ironic_inspector/test/functional.py @@ -231,8 +231,10 @@ class Base(base.NodeTest): error=error), status ) + # CI Runs in UTC, local machines can fail on the use of the local + # timezone. curr_time = datetime.datetime.fromtimestamp( - time.time(), tz=pytz.timezone(time.tzname[0])) + time.time(), tz=pytz.timezone('UTC')) started_at = timeutils.parse_isotime(status['started_at']) self.assertLess(started_at, curr_time) if finished: