diff options
-rw-r--r-- | t/lib-httpd.sh | 12 | ||||
-rwxr-xr-x | t/t5541-http-push-smart.sh | 6 | ||||
-rwxr-xr-x | t/t5551-http-fetch-smart.sh | 3 | ||||
-rwxr-xr-x | t/t5561-http-backend.sh | 3 |
4 files changed, 16 insertions, 8 deletions
diff --git a/t/lib-httpd.sh b/t/lib-httpd.sh index b6788fea57..7f060aebd0 100644 --- a/t/lib-httpd.sh +++ b/t/lib-httpd.sh @@ -296,3 +296,15 @@ strip_access_log() { s/^GET /GET / " "$HTTPD_ROOT_PATH"/access.log } + +# Requires one argument: the name of a file containing the expected stripped +# access log entries. +check_access_log() { + sort "$1" >"$1".sorted && + strip_access_log >access.log.stripped && + sort access.log.stripped >access.log.sorted && + if ! test_cmp "$1".sorted access.log.sorted + then + test_cmp "$1" access.log.stripped + fi +} diff --git a/t/t5541-http-push-smart.sh b/t/t5541-http-push-smart.sh index 3fbe7722ff..918822868e 100755 --- a/t/t5541-http-push-smart.sh +++ b/t/t5541-http-push-smart.sh @@ -47,8 +47,7 @@ test_expect_success 'no empty path components' ' cd "$ROOT_PATH" && git clone $HTTPD_URL/smart/test_repo.git/ test_repo_clone && - strip_access_log >act && - test_cmp exp act + check_access_log exp ' test_expect_success 'clone remote repository' ' @@ -129,8 +128,7 @@ GET /smart/test_repo.git/info/refs?service=git-receive-pack HTTP/1.1 200 POST /smart/test_repo.git/git-receive-pack HTTP/1.1 200 EOF test_expect_success 'used receive-pack service' ' - strip_access_log >act && - test_cmp exp act + check_access_log exp ' test_http_push_nonff "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git \ diff --git a/t/t5551-http-fetch-smart.sh b/t/t5551-http-fetch-smart.sh index 5f98fa90af..f0b03e5190 100755 --- a/t/t5551-http-fetch-smart.sh +++ b/t/t5551-http-fetch-smart.sh @@ -98,8 +98,7 @@ GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1 200 POST /smart/repo.git/git-upload-pack HTTP/1.1 200 EOF test_expect_success 'used upload-pack service' ' - strip_access_log >act && - test_cmp exp act + check_access_log exp ' test_expect_success 'follow redirects (301)' ' diff --git a/t/t5561-http-backend.sh b/t/t5561-http-backend.sh index 6a0f240e6d..28c74b80a8 100755 --- a/t/t5561-http-backend.sh +++ b/t/t5561-http-backend.sh @@ -123,8 +123,7 @@ GET /smart/repo.git/info/refs?service=git-receive-pack HTTP/1.1 403 - POST /smart/repo.git/git-receive-pack HTTP/1.1 403 - EOF test_expect_success 'server request log matches test results' ' - strip_access_log >act && - test_cmp exp act + check_access_log exp ' stop_httpd |