author | Alberto Bertogli
<albertito@blitiri.com.ar> 2023-01-28 21:19:10 UTC |
committer | Alberto Bertogli
<albertito@blitiri.com.ar> 2023-01-30 10:48:29 UTC |
parent | 48496cafe27d15c73030300b27622acb35a6544d |
test/bad-conf-1.yaml | +4 | -0 |
test/bad-conf-2.yaml | +16 | -0 |
test/test.sh | +22 | -0 |
diff --git a/test/bad-conf-1.yaml b/test/bad-conf-1.yaml new file mode 100644 index 0000000..73a7c21 --- /dev/null +++ b/test/bad-conf-1.yaml @@ -0,0 +1,4 @@ + +# Bad configuration file: it is missing routes, and either certs or autocerts. +https: + ":8442": diff --git a/test/bad-conf-2.yaml b/test/bad-conf-2.yaml new file mode 100644 index 0000000..080a924 --- /dev/null +++ b/test/bad-conf-2.yaml @@ -0,0 +1,16 @@ + +# Bad configuration file: reqlog points to a file that cannot be created. +# This helps check that the error when opening a reqlog is handled early and +# as expected. +http: + ":8442": + routes: + "/": + file: "testdata/file" + + reqlog: + "/": "log" + +reqlog: + "log": + file: "/does/not/exist" diff --git a/test/test.sh b/test/test.sh index b105cfd..23b2848 100755 --- a/test/test.sh +++ b/test/test.sh @@ -68,6 +68,28 @@ if ! gofer -configfile=.be-print-conf -configcheck; then exit 1 fi +if gofer -configfile=does-not-exist; then + echo "Expected error on a non-existing config" + exit 1 +fi + +if gofer -configfile=bad-conf-1.yaml; then + echo "bad config 1: expected error exit" + exit 1 +fi +if ! waitgrep -q "invalid configuration" .out.log; then + echo "bad config 1: expected 'invalid configuration'" + exit 1 +fi + +if gofer -configfile=bad-conf-2.yaml; then + echo "bad config 2: Expected error exit" + exit 1 +fi +if ! waitgrep -q "reqlog \"log\" failed to initialize:" .out.log; then + echo "bad config 2: Expected 'reqlog "log" failed to initialize'" + exit 1 +fi # Common tests, for both servers. for base in \