git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: git@vger.kernel.org
Subject: [PATCH 1/3] t5553: use local url for invalid fetch
Date: Wed, 26 Jun 2024 16:54:28 -0400	[thread overview]
Message-ID: <20240626205428.GA1457138@coredump.intra.peff.net> (raw)
In-Reply-To: <20240626205355.GA1009060@coredump.intra.peff.net>

We test how "fetch --set-upstream" behaves when given an invalid URL,
using the bogus URL "http://nosuchdomain.example.com". But finding out
that it is invalid requires an actual DNS lookup.

Reduce our dependency on external factors by using an invalid local
filesystem URL, which works just as well for our purposes.

Signed-off-by: Jeff King <peff@peff.net>
---
 t/t5553-set-upstream.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/t/t5553-set-upstream.sh b/t/t5553-set-upstream.sh
index 48050162c2..70e3376d31 100755
--- a/t/t5553-set-upstream.sh
+++ b/t/t5553-set-upstream.sh
@@ -73,10 +73,10 @@ test_expect_success 'fetch --set-upstream main:other does not set the branch oth
 	check_config_missing other2
 '
 
-test_expect_success 'fetch --set-upstream http://nosuchdomain.example.com fails with invalid url' '
+test_expect_success 'fetch --set-upstream ./does-not-exist fails with invalid url' '
 	# main explicitly not cleared, we check that it is not touched from previous value
 	clear_config other other2 &&
-	test_must_fail git fetch --set-upstream http://nosuchdomain.example.com &&
+	test_must_fail git fetch --set-upstream ./does-not-exist &&
 	check_config main upstream refs/heads/other &&
 	check_config_missing other &&
 	check_config_missing other2
@@ -143,10 +143,10 @@ test_expect_success 'pull --set-upstream upstream tag does not set the tag' '
 	check_config_missing three
 '
 
-test_expect_success 'pull --set-upstream http://nosuchdomain.example.com fails with invalid url' '
+test_expect_success 'pull --set-upstream ./does-not-exist fails with invalid url' '
 	# main explicitly not cleared, we check that it is not touched from previous value
 	clear_config other other2 three &&
-	test_must_fail git pull --set-upstream http://nosuchdomain.example.com &&
+	test_must_fail git pull --set-upstream ./does-not-exist &&
 	check_config main upstream refs/heads/other &&
 	check_config_missing other &&
 	check_config_missing other2 &&
-- 
2.45.2.1058.g2ff574fec9


  reply	other threads:[~2024-06-26 20:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-26 20:53 [PATCH 0/3] reduce test suite dependency on network Jeff King
2024-06-26 20:54 ` Jeff King [this message]
2024-06-26 20:55 ` [PATCH 2/3] t5551: do not confirm that bogus url cannot be used Jeff King
2024-06-26 20:57 ` [PATCH 3/3] t/lib-bundle-uri: use local fake bundle URLs Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240626205428.GA1457138@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).