]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Fix spurious failure in cipher tests developer/arr2036
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 28 Jan 2026 03:25:09 +0000 (19:25 -0800)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 28 Jan 2026 03:25:09 +0000 (19:25 -0800)
src/tests/modules/cipher/valid.unlang

index a7a9ac70e4e1fdb77d85a0181b1f063eb2dc2029..5d11c02d57b87ce2b0720f41e9005ff2481d8689 100644 (file)
@@ -1,11 +1,14 @@
 date test_date1
 date test_date2
+time_delta test_delta
 
 test_date1 := %cipher_rsa.certificate('notBefore')
 test_date2 := %cipher_rsa.certificate('notAfter')
 
-# Check the cert validity period is 30 days
-if !((test_date2 - test_date1) == ((time_delta) (86400 * 60))) {
+test_delta = (test_date2 - test_date1) - (time_delta) (86400 * 60)
+
+# Check the cert validity period is 30 days.  Add fudge factor for issuance occuring across a second boundary
+if !((test_delta >= -1) && (test_delta <= 1)) {
        test_fail
 } else {
        test_pass