Skip to content

Commit 795d713

Browse files
peffgitster
authored andcommitted
t5551: handle v2 protocol in upload-pack service test
We perform a clone and a fetch, and then check that we saw the expected requests in Apache's access log. In the v2 protocol, there will be one extra request to /git-upload-pack for each operation (since the initial /info/refs probe is just used to upgrade the protocol). As a result, this test is a noop unless the use of the v0 protocol is forced. Which means that hardly anybody runs it, since you have to do so manually. Let's update it to handle v2 and run it always. We could do this by just conditionally adding in the extra POST lines. But if we look at the origin of the test in 7da4e22 (test smart http fetch and push, 2009-10-30), the point is really just to make sure that the smart git-upload-pack service was used at all. So rather than counting up the individual requests, let's just make sure we saw each of the expected types. This is a bit looser, but makes maintenance easier. Since we're now matching with grep, we can also loosen the HTTP/1.1 match, which allows this test to pass when run with HTTP/2 via t5559. That lets: GIT_TEST_PROTOCOL_VERSION=0 ./t5559-http-fetch-smart-http2.sh run to completion, which previously failed (and of course it works if you use v2, as well). Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1c5a638 commit 795d713

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

t/t5551-http-fetch-smart.sh

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -143,19 +143,9 @@ test_expect_success 'fetch changes via http' '
143143
'
144144

145145
test_expect_success 'used upload-pack service' '
146-
cat >exp <<-\EOF &&
147-
GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1 200
148-
POST /smart/repo.git/git-upload-pack HTTP/1.1 200
149-
GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1 200
150-
POST /smart/repo.git/git-upload-pack HTTP/1.1 200
151-
EOF
152-
153-
# NEEDSWORK: If the overspecification of the expected result is reduced, we
154-
# might be able to run this test in all protocol versions.
155-
if test "$GIT_TEST_PROTOCOL_VERSION" = 0
156-
then
157-
check_access_log exp
158-
fi
146+
strip_access_log >log &&
147+
grep "GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/[0-9.]* 200" log &&
148+
grep "POST /smart/repo.git/git-upload-pack HTTP/[0-9.]* 200" log
159149
'
160150

161151
test_expect_success 'follow redirects (301)' '

0 commit comments

Comments
 (0)