[pmg-devel] [PATCH pmg-api 1/3] tests: test_utils: do not rely on system timezone

Stoiko Ivanov s.ivanov at proxmox.com
Fri Jan 2 21:31:59 CET 2026


the tests for format_date_header inherently rely on a timezone being
set (as the date-format in mail-headers expects one).

running the test in a build-environment like sbuild, which has the
timezone set to UTC fails.

fix this by explicitly setting the timezone to 'Europe/Vienna'.

Suggested-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
 src/tests/test_utils.pl | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/tests/test_utils.pl b/src/tests/test_utils.pl
index 8abcc8b7..ff856ebe 100755
--- a/src/tests/test_utils.pl
+++ b/src/tests/test_utils.pl
@@ -4,10 +4,13 @@ use strict;
 use warnings;
 
 use Test::More;
-use POSIX qw(setlocale strftime);
+use POSIX qw(setlocale strftime tzset);
 
 use PMG::Utils;
 
+$ENV{TZ} = 'Europe/Vienna';
+tzset();
+
 subtest 'format_date_header works' => sub {
     cmp_ok(length(PMG::Utils::format_date_header(localtime())), '>=', 30);
     is(
-- 
2.47.3





More information about the pmg-devel mailing list