From f840deba33f0b719fed0c9b6ad33a2a181406b38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicki=20K=C5=99=C3=AD=C5=BEek?= Date: Mon, 21 Oct 2024 12:08:52 +0200 Subject: [PATCH 1/2] Use UTC timezone when handling keys in kasp test library When working with key timestamps, ensure we correctly set the UTC timezone in order for the tests to work consistently regardless of the local time setting. --- bin/tests/system/isctest/kasp.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bin/tests/system/isctest/kasp.py b/bin/tests/system/isctest/kasp.py index ea1ec9878e..6402998471 100644 --- a/bin/tests/system/isctest/kasp.py +++ b/bin/tests/system/isctest/kasp.py @@ -17,8 +17,7 @@ import subprocess import time from typing import Optional, Union -from datetime import datetime -from datetime import timedelta +from datetime import datetime, timedelta, timezone import dns import isctest.log @@ -54,7 +53,9 @@ class KeyTimingMetadata: def __init__(self, timestamp: str): if int(timestamp) <= 0: raise ValueError(f'invalid timing metadata value: "{timestamp}"') - self.value = datetime.strptime(timestamp, self.FORMAT) + self.value = datetime.strptime(timestamp, self.FORMAT).replace( + tzinfo=timezone.utc + ) def __repr__(self): return self.value.strftime(self.FORMAT) @@ -95,7 +96,7 @@ class KeyTimingMetadata: @staticmethod def now() -> "KeyTimingMetadata": result = KeyTimingMetadata.__new__(KeyTimingMetadata) - result.value = datetime.now() + result.value = datetime.now(timezone.utc) return result From 46810be809aa2ffc7ee7f305f10f29c5b9121423 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicki=20K=C5=99=C3=AD=C5=BEek?= Date: Mon, 21 Oct 2024 12:18:43 +0200 Subject: [PATCH 2/2] Set TZ to Australia/Sydney for bookworm CI job Use a different timezone via the TZ variable in at least one of the system test jobs in order to detect possible issues with timezone handling in python. --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ef8813cdd0..55f58ff330 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -900,6 +900,7 @@ system:gcc:bookworm:amd64: <<: *system_test_gcov_job variables: CI_ENABLE_ALL_TESTS: 1 + TZ: Australia/Sydney needs: - job: unit:gcc:bookworm:amd64 artifacts: true