]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
config tests: better test net.tls_sticket_secret()
authorVladimír Čunát <vladimir.cunat@nic.cz>
Fri, 10 Jul 2020 12:35:36 +0000 (14:35 +0200)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Fri, 10 Jul 2020 12:35:36 +0000 (14:35 +0200)
The trick there is that it isn't supported (by us) on gnutls < 3.6.3.
I checked that the test fails before the fix in parent commit
and that it succeeds (is skipped) with gnutls 3.6.2.

tests/config/tls.test.lua

index 23b6618823529abacffe1bbaf74fab93ac1a50cf..ef811bbab9f46c346344307c37f6e90ecba82327 100644 (file)
@@ -1,10 +1,14 @@
+local ffi = require('ffi')
+ffi.cdef([[ const char * gnutls_check_version (const char * req_version); ]])
+
 -- SPDX-License-Identifier: GPL-3.0-or-later
 local function test_session_config()
        ok(net.tls_sticket_secret(),
-          'net.tls_sticket_secret() to trigger key regeneration')
-       -- There is no sufficiently new stable release of GnuTLS.
-       -- ok(net.tls_sticket_secret('0123456789ABCDEF0123456789ABCDEF'),
-       --    'net.tls_sticket_secret with valid key')
+                'net.tls_sticket_secret() to trigger key regeneration')
+       if ffi.C.gnutls_check_version("3.6.3") ~= nil then
+               ok(net.tls_sticket_secret('0123456789ABCDEF0123456789ABCDEF'),
+                        'net.tls_sticket_secret with valid key')
+       end
        boom(net.tls_sticket_secret, {{}},
             'net.tls_sticket_secret({}) is invalid')
        boom(net.tls_sticket_secret, {'0123456789ABCDEF0123456789ABCDE'},