]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests/py: Set a fixed timezone in nft-test.py
authorPhil Sutter <phil@nwl.cc>
Sat, 16 Nov 2019 21:32:18 +0000 (22:32 +0100)
committerPhil Sutter <phil@nwl.cc>
Fri, 29 Nov 2019 09:25:54 +0000 (10:25 +0100)
Payload generated for 'meta time' matches depends on host's timezone and
DST setting. To produce constant output, set a fixed timezone in
nft-test.py. Choose UTC-2 since most payloads are correct then, adjust
the remaining two tests.

Fixes: 0518ea3f70d8c ("tests: add meta time test cases")
Signed-off-by: Phil Sutter <phil@nwl.cc>
Acked-by: Ander Juaristi <a@juaristi.eus>
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
tests/py/any/meta.t
tests/py/any/meta.t.payload
tests/py/nft-test.py

index 86e5d258605dc40ce0b710c181530b0f6e010fb4..327f973f1bd5afa05bb628a8b395fc33c77e19b6 100644 (file)
@@ -205,7 +205,7 @@ meta random eq 1;ok;meta random 1
 meta random gt 1000000;ok;meta random > 1000000
 
 meta time "1970-05-23 21:07:14" drop;ok
-meta time 12341234 drop;ok;meta time "1970-05-23 21:07:14" drop
+meta time 12341234 drop;ok;meta time "1970-05-23 22:07:14" drop
 meta time "2019-06-21 17:00:00" drop;ok
 meta time "2019-07-01 00:00:00" drop;ok
 meta time "2019-07-01 00:01:00" drop;ok
index 402caae5cad8c0cfda6d9c6a2653719a28294daf..486d7aa566ea36fa316d29234b0b0ca22f3021db 100644 (file)
@@ -1050,7 +1050,7 @@ ip test-ip4 input
 # meta time "1970-05-23 21:07:14" drop
 ip meta-test input
   [ meta load time => reg 1 ]
-  [ cmp eq reg 1 0x74a8f400 0x002bd849 ]
+  [ cmp eq reg 1 0x43f05400 0x002bd503 ]
   [ immediate reg 0 drop ]
 
 # meta time 12341234 drop
index ce42b5ddb1ccac42d34503d7ff7c479e38b8896d..6edca3c6a5a2f4298451f96feb94e7b5f011bf1f 100755 (executable)
@@ -24,6 +24,7 @@ import tempfile
 
 TESTS_PATH = os.path.dirname(os.path.abspath(__file__))
 sys.path.insert(0, os.path.join(TESTS_PATH, '../../py/'))
+os.environ['TZ'] = 'UTC-2'
 
 from nftables import Nftables