From ef3fa00fde355010de40b665e45371a30582cd02 Mon Sep 17 00:00:00 2001 From: Jacob Bachmeyer Date: Wed, 22 Mar 2023 22:00:44 -0500 Subject: [PATCH] Add tests to complete code coverage for configuration parsing --- testsuite/gatekeeper.all/20_config.exp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/testsuite/gatekeeper.all/20_config.exp b/testsuite/gatekeeper.all/20_config.exp index a49117c..8ed3f45 100644 --- a/testsuite/gatekeeper.all/20_config.exp +++ b/testsuite/gatekeeper.all/20_config.exp @@ -86,6 +86,14 @@ proc do_configuration_test { testname confname conftext arglist expected } { # ---------------------------------------- +do_configuration_test "parse invalid configuration" bogus.conf \ + {test[]=bogus-configuration-item} {} \ + { !0 { "unrecognized configuration line" } } + +do_configuration_test "configuration file missing" bogus.conf \ + {} { --conf=does-not-exist.conf } \ + { !0 { "read config does-not-exist.conf:" } } + do_configuration_test "parse empty configuration" empty.conf {} {} { !0 { "# gatekeeper configuration as parsed:" @@ -103,6 +111,8 @@ do_configuration_test "parse empty configuration" empty.conf {} {} { } } +# ---------------------------------------- + set configuration_file(basic) {# gatekeeper configuration parsing test tag = config_test @@ -255,6 +265,22 @@ do_configuration_test "parse zone configuration: bar" zone.conf \ } } +do_configuration_test "unknown zone baz" zone.conf \ + $configuration_file(zone-basic) {-z baz} { + !0 + { {requested zone 'baz' not configured[\r\n]+} + {known zones: foo bar[\r\n]+} + } + } + +do_configuration_test "no zone specified but zones configured" zone.conf \ + $configuration_file(zone-basic) {} { + !0 + { {zones configured but --zone parameter not given} + {known zones: foo bar[\r\n]+} + } + } + # ---------------------------------------- # EOF -- 2.25.1