From: Petr Špaček Date: Wed, 13 Jun 2018 14:00:01 +0000 (+0200) Subject: daemon/tls: add basic config tests X-Git-Tag: v2.4.0~24^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=836db05bef8396b967d72646ff6a8f2f7c373fc5;p=thirdparty%2Fknot-resolver.git daemon/tls: add basic config tests --- diff --git a/tests/config/tls.test.lua b/tests/config/tls.test.lua new file mode 100644 index 000000000..96934df2e --- /dev/null +++ b/tests/config/tls.test.lua @@ -0,0 +1,23 @@ +local function test_session_config() + ok(net.tls_sticket_secret(), + 'net.tls_sticket_secret() to trigger key regeneration') + ok(net.tls_sticket_secret('0123456789ABCDEF0123456789ABCDEF'), + 'net.tls_sticket_secret with valid key') + boom(net.tls_sticket_secret, {{}}, + 'net.tls_sticket_secret({}) is invalid') + boom(net.tls_sticket_secret, {'0123456789ABCDEF0123456789ABCDE'}, + 'net.tls_sticket_secret with too short key') + + boom(net.tls_sticket_secret_file, {}, + 'net.tls_sticket_secret_file without filename') + boom(net.tls_sticket_secret_file, {{}}, + 'net.tls_sticket_secret_file with non-string filename') + boom(net.tls_sticket_secret_file, {'/tmp/a_non_existent_file_REALLY_1528898130'}, + 'net.tls_sticket_secret_file with non-existent filename') + boom(net.tls_sticket_secret_file, {'/dev/null'}, + 'net.tls_sticket_secret_file with empty file') +end + +return { + test_session_config +}