mirror of https://github.com/omar-polo/gmid.git
add a test for the file logging
This commit is contained in:
parent
226f13ece0
commit
60b4efa1e2
|
@ -58,6 +58,7 @@ run_test test_proxy_relay_to
|
|||
run_test test_proxy_with_certs
|
||||
# run_test test_unknown_host # XXX: breaks on some distro
|
||||
run_test test_include_mime
|
||||
run_test test_log_file
|
||||
|
||||
# TODO: add test that uses only a TLSv1.2 or TLSv1.3
|
||||
# TODO: add a test that attempt to serve a non-regular file
|
||||
|
|
|
@ -377,3 +377,23 @@ test_include_mime() {
|
|||
fetch_hdr /foo.1
|
||||
check_reply '20 text/x-mandoc' || return 1
|
||||
}
|
||||
|
||||
test_log_file() {
|
||||
rm -f log log.edited
|
||||
setup_simple_test 'log access "'$PWD'/log"' ''
|
||||
|
||||
fetch_hdr /
|
||||
check_reply '20 text/gemini'
|
||||
|
||||
# remove the <ip>:<port> leading part
|
||||
awk '{$1 = ""; print substr($0, 2)}' log > log.edited
|
||||
|
||||
echo GET gemini://localhost/ 20 text/gemini | cmp -s - log.edited
|
||||
if [ $? -ne 0 ]; then
|
||||
# keep the log for post-mortem analysis
|
||||
return 1
|
||||
fi
|
||||
|
||||
rm -f log log.edited
|
||||
return 0
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue