]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t/lib-bundle-uri: use local fake bundle URLs
authorJeff King <peff@peff.net>
Wed, 26 Jun 2024 20:57:45 +0000 (16:57 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 26 Jun 2024 21:31:18 +0000 (14:31 -0700)
A few of the bundle URI tests point config at a fake bundle; they care
only that the client has been configured with _some_ bundle, but it
doesn't have to actually contain objects.

For the file:// tests, we use "$BUNDLE_URI_REPO_URI/fake.bdl", a
non-existent file inside the actual remote repo. But for git:// and
http:// tests, we use "https://example.com/fake.bdl". This works OK in
practice, but it means we actually make a request to example.com (which
returns a placeholder HTML response). That can be annoying when running
the test suite on a spotty network (it doesn't produce a wrong result,
since we expect it to fail, but it may introduce delays).

We can reduce our dependency on the outside world by using a local URL.
It would work to just do "file://$PWD/fake.bdl" here, since the bundle
code does not care about the actual location. But in the long run I
suspect we may have more restrictions on which protocols can be passed
around as bundle URIs. So instead, let's stick with the file:// repo's
pattern and just point to a bogus name based on the remote repo's URL.

For http this makes perfect sense; we'll make a request to the local
http server and find that there's nothing there. For git:// it's a
little weird, as you wouldn't normally access a bundle file over git://
at all. But it's probably the most reasonable guess we can make for now,
and anybody who tightens protocol selection later will know better
what's the best path forward.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/lib-bundle-uri-protocol.sh

index a4a1af8d0298e62fa0d4ee373b245191efa10b4a..de09b6b02e248583d972ac5340fb2f550da3ac7f 100644 (file)
@@ -18,7 +18,7 @@ git)
        start_git_daemon --export-all --enable=receive-pack
        BUNDLE_URI_PARENT="$GIT_DAEMON_DOCUMENT_ROOT_PATH/parent"
        BUNDLE_URI_REPO_URI="$GIT_DAEMON_URL/parent"
-       BUNDLE_URI_BUNDLE_URI="https://example.com/fake.bdl"
+       BUNDLE_URI_BUNDLE_URI="$BUNDLE_URI_REPO_URI/fake.bdl"
        test_set_prereq BUNDLE_URI_GIT
        ;;
 http)
@@ -26,7 +26,7 @@ http)
        start_httpd
        BUNDLE_URI_PARENT="$HTTPD_DOCUMENT_ROOT_PATH/http_parent"
        BUNDLE_URI_REPO_URI="$HTTPD_URL/smart/http_parent"
-       BUNDLE_URI_BUNDLE_URI="https://example.com/fake.bdl"
+       BUNDLE_URI_BUNDLE_URI="$BUNDLE_URI_REPO_URL/fake.bdl"
        test_set_prereq BUNDLE_URI_HTTP
        ;;
 *)