git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/3] t5551: do not confirm that bogus url cannot be used

From
Jeff King <peff@peff.net>
Date
Jun 26, 2024, 20:55 UTC
Message-ID
<20240626205525.GB1457138@coredump.intra.peff.net>
In-Reply-To
<20240626205355.GA1009060@coredump.intra.peff.net>

t5551 tries to access a URL with a bogus hostname and confirms that http.curloptResolve lets us use this otherwise unresolvable name.

Before doing so, though, we confirm that trying to access the bogus hostname without http.curloptResolve fails as expected. This isn't testing Git at all, but is confirming the test's assumptions. That's often a good thing to do, but in this case it means that we'll actually try to resolve the external name. Even though it's unlikely that "gitbogusexamplehost.invalid" would ever resolve, the DNS lookup itself may take time.

It's probably reasonable to just assume that this obviously-bogus name would not actually resolve in practice, which lets us reduce our test suite's dependency on the outside world.

Signed-off-by: Jeff King <peff@peff.net>
---
 t/t5551-http-fetch-smart.sh | 1 -
 1 file changed, 1 deletion(-)
diff --git a/t/t5551-http-fetch-smart.sh b/t/t5551-http-fetch-smart.sh
index a623a1058c..7b5ab0eae1 100755
--- a/t/t5551-http-fetch-smart.sh
+++ b/t/t5551-http-fetch-smart.sh
@@ -643,7 +643,6 @@ test_expect_success 'clone empty SHA-256 repository with protocol v0' '
 test_expect_success 'passing hostname resolution information works' '
 	BOGUS_HOST=gitbogusexamplehost.invalid &&
 	BOGUS_HTTPD_URL=$HTTPD_PROTO://$BOGUS_HOST:$LIB_HTTPD_PORT &&
-	test_must_fail git ls-remote "$BOGUS_HTTPD_URL/smart/repo.git" >/dev/null &&
 	git -c "http.curloptResolve=$BOGUS_HOST:$LIB_HTTPD_PORT:127.0.0.1" ls-remote "$BOGUS_HTTPD_URL/smart/repo.git" >/dev/null
 '
 
-- 
2.45.2.1058.g2ff574fec9
Previous: Jeff KingNext: Jeff King
Message 3 of 4 in “reduce test suite dependency on network”
  1. 0/3 reduce test suite dependency on networkJeff King, Jun 26, 2024
  2. 1/3 t5553: use local url for invalid fetchJeff King, Jun 26, 2024
  3. 2/3 t5551: do not confirm that bogus url cannot be usedJeff King, Jun 26, 2024
  4. 3/3 t/lib-bundle-uri: use local fake bundle URLsJeff King, Jun 26, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.