author | Alberto Bertogli
<albertito@blitiri.com.ar> 2022-08-27 23:58:41 UTC |
committer | Alberto Bertogli
<albertito@blitiri.com.ar> 2022-08-28 00:18:17 UTC |
parent | b13f7cc81598b688602753acc37d52234401da19 |
test/test.sh | +13 | -4 |
test/testdata/expected-printed-01-be-config | +38 | -0 |
diff --git a/test/test.sh b/test/test.sh index a50de17..7f6732b 100755 --- a/test/test.sh +++ b/test/test.sh @@ -48,10 +48,19 @@ if ! gofer -configfile=.be-debug-conf -configcheck; then exit 1 fi -gofer -configfile=01-be.yaml -configprint > .be-print-conf -if diff -q 01-be.yaml .be-print-conf; then - echo "Printed and debug configs differ:" - diff 01-be.yaml .be-print-conf +# Use gofer to print the parsed config. Strip out the coverage summary output +# (if present), which unfortunately cannot be disabled. +../gofer $COVER_ARGS -configfile=01-be.yaml -configprint \ + | grep -v -E '^(PASS|coverage: .* of statements in .*)$' \ + > .be-print-conf +if ! diff -q testdata/expected-printed-01-be-config .be-print-conf; then + echo "Printed config is different than expected:" + diff -u testdata/expected-printed-01-be-config .be-print-conf + exit 1 +fi + +if ! gofer -configfile=.be-print-conf -configcheck; then + echo "Failed to parse BE config from -configprint" exit 1 fi diff --git a/test/testdata/expected-printed-01-be-config b/test/testdata/expected-printed-01-be-config new file mode 100644 index 0000000..49b6c48 --- /dev/null +++ b/test/testdata/expected-printed-01-be-config @@ -0,0 +1,38 @@ +control_addr: 127.0.0.1:8459 +http: + :8450: + routes: + /authdir/: + dir: testdata/dir + /cgi/: + cgi: + - testdata/cgi.sh + - param 1 + - param 2 + /dir/: + dir: testdata/dir + diropts: + listing: + /: true + /withindex/: false + /withoutindex/: false + exclude: + - /ignored\..* + /file: + file: testdata/file + /file/second: + file: testdata/dir/ñaca + /status/543: + status: 543 + auth: + /authdir/withoutindex/: testdata/authdb.yaml + /authdir/ñaca: testdata/authdb.yaml + setheader: + /file: + X-My-Header: my lovely header + reqlog: + /: requests +reqlog: + requests: + file: .01-be.requests.log + bufsize: 10