Merge branch 'sg/httpd-test-unflake'
httpd tests saw occasional breakage due to the way its access log gets inspected by the tests, which has been updated to make them less flaky. * sg/httpd-test-unflake: t/lib-httpd: avoid occasional failures when checking access.log t/lib-httpd: add the strip_access_log() helper function t5541: clean up truncating access log
This commit is contained in:
commit
bc6d33e87a
@ -288,3 +288,24 @@ expect_askpass() {
|
|||||||
test_cmp "$TRASH_DIRECTORY/askpass-expect" \
|
test_cmp "$TRASH_DIRECTORY/askpass-expect" \
|
||||||
"$TRASH_DIRECTORY/askpass-query"
|
"$TRASH_DIRECTORY/askpass-query"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
strip_access_log() {
|
||||||
|
sed -e "
|
||||||
|
s/^.* \"//
|
||||||
|
s/\"//
|
||||||
|
s/ [1-9][0-9]*\$//
|
||||||
|
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
|
||||||
|
}
|
||||||
|
@ -38,25 +38,16 @@ GET /smart/test_repo.git/info/refs?service=git-upload-pack HTTP/1.1 200
|
|||||||
POST /smart/test_repo.git/git-upload-pack HTTP/1.1 200
|
POST /smart/test_repo.git/git-upload-pack HTTP/1.1 200
|
||||||
EOF
|
EOF
|
||||||
test_expect_success 'no empty path components' '
|
test_expect_success 'no empty path components' '
|
||||||
|
# Clear the log, so that it does not affect the "used receive-pack
|
||||||
|
# service" test which reads the log too.
|
||||||
|
test_when_finished ">\"\$HTTPD_ROOT_PATH\"/access.log" &&
|
||||||
|
|
||||||
# In the URL, add a trailing slash, and see if git appends yet another
|
# In the URL, add a trailing slash, and see if git appends yet another
|
||||||
# slash.
|
# slash.
|
||||||
cd "$ROOT_PATH" &&
|
cd "$ROOT_PATH" &&
|
||||||
git clone $HTTPD_URL/smart/test_repo.git/ test_repo_clone &&
|
git clone $HTTPD_URL/smart/test_repo.git/ test_repo_clone &&
|
||||||
|
|
||||||
sed -e "
|
check_access_log exp
|
||||||
s/^.* \"//
|
|
||||||
s/\"//
|
|
||||||
s/ [1-9][0-9]*\$//
|
|
||||||
s/^GET /GET /
|
|
||||||
" >act <"$HTTPD_ROOT_PATH"/access.log &&
|
|
||||||
|
|
||||||
# Clear the log, so that it does not affect the "used receive-pack
|
|
||||||
# service" test which reads the log too.
|
|
||||||
#
|
|
||||||
# We do this before the actual comparison to ensure the log is cleared.
|
|
||||||
echo > "$HTTPD_ROOT_PATH"/access.log &&
|
|
||||||
|
|
||||||
test_cmp exp act
|
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'clone remote repository' '
|
test_expect_success 'clone remote repository' '
|
||||||
@ -124,7 +115,6 @@ test_expect_success 'rejected update prints status' '
|
|||||||
rm -f "$HTTPD_DOCUMENT_ROOT_PATH/test_repo.git/hooks/update"
|
rm -f "$HTTPD_DOCUMENT_ROOT_PATH/test_repo.git/hooks/update"
|
||||||
|
|
||||||
cat >exp <<EOF
|
cat >exp <<EOF
|
||||||
|
|
||||||
GET /smart/test_repo.git/info/refs?service=git-upload-pack HTTP/1.1 200
|
GET /smart/test_repo.git/info/refs?service=git-upload-pack HTTP/1.1 200
|
||||||
POST /smart/test_repo.git/git-upload-pack HTTP/1.1 200
|
POST /smart/test_repo.git/git-upload-pack HTTP/1.1 200
|
||||||
GET /smart/test_repo.git/info/refs?service=git-receive-pack HTTP/1.1 200
|
GET /smart/test_repo.git/info/refs?service=git-receive-pack HTTP/1.1 200
|
||||||
@ -138,13 +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
|
POST /smart/test_repo.git/git-receive-pack HTTP/1.1 200
|
||||||
EOF
|
EOF
|
||||||
test_expect_success 'used receive-pack service' '
|
test_expect_success 'used receive-pack service' '
|
||||||
sed -e "
|
check_access_log exp
|
||||||
s/^.* \"//
|
|
||||||
s/\"//
|
|
||||||
s/ [1-9][0-9]*\$//
|
|
||||||
s/^GET /GET /
|
|
||||||
" >act <"$HTTPD_ROOT_PATH"/access.log &&
|
|
||||||
test_cmp exp act
|
|
||||||
'
|
'
|
||||||
|
|
||||||
test_http_push_nonff "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git \
|
test_http_push_nonff "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git \
|
||||||
|
@ -103,13 +103,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
|
POST /smart/repo.git/git-upload-pack HTTP/1.1 200
|
||||||
EOF
|
EOF
|
||||||
test_expect_success 'used upload-pack service' '
|
test_expect_success 'used upload-pack service' '
|
||||||
sed -e "
|
check_access_log exp
|
||||||
s/^.* \"//
|
|
||||||
s/\"//
|
|
||||||
s/ [1-9][0-9]*\$//
|
|
||||||
s/^GET /GET /
|
|
||||||
" >act <"$HTTPD_ROOT_PATH"/access.log &&
|
|
||||||
test_cmp exp act
|
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'follow redirects (301)' '
|
test_expect_success 'follow redirects (301)' '
|
||||||
|
@ -129,13 +129,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 -
|
POST /smart/repo.git/git-receive-pack HTTP/1.1 403 -
|
||||||
EOF
|
EOF
|
||||||
test_expect_success 'server request log matches test results' '
|
test_expect_success 'server request log matches test results' '
|
||||||
sed -e "
|
check_access_log exp
|
||||||
s/^.* \"//
|
|
||||||
s/\"//
|
|
||||||
s/ [1-9][0-9]*\$//
|
|
||||||
s/^GET /GET /
|
|
||||||
" >act <"$HTTPD_ROOT_PATH"/access.log &&
|
|
||||||
test_cmp exp act
|
|
||||||
'
|
'
|
||||||
|
|
||||||
stop_httpd
|
stop_httpd
|
||||||
|
Loading…
Reference in New Issue
Block a user