From 875db0af2d3768fc2d3649f1911479a85df2f6f6 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Wed, 24 Jun 2026 08:45:55 +0200 Subject: [PATCH] net_err_suggests_fetch_with_cli: Try to fix timeouts once again Do not rely on negative matches such as "cargo output does not suggest using fetch_with_cli". Instead, verify that cargo actually calls git fetch on the remote repo. Use timeout to cover systems where git ignores the http timeout. Increase test timeout to 15m --- .../net_err_suggests_fetch_with_cli/main.fmf | 1 + .../runtest.sh | 50 +++++++++---------- 2 files changed, 24 insertions(+), 27 deletions(-) diff --git a/tests/Sanity/net_err_suggests_fetch_with_cli/main.fmf b/tests/Sanity/net_err_suggests_fetch_with_cli/main.fmf index 0de32b5..8d6c70a 100644 --- a/tests/Sanity/net_err_suggests_fetch_with_cli/main.fmf +++ b/tests/Sanity/net_err_suggests_fetch_with_cli/main.fmf @@ -13,3 +13,4 @@ description: | support libssh2 in RHEL/CentOS. tier: 1 +duration: 15m diff --git a/tests/Sanity/net_err_suggests_fetch_with_cli/runtest.sh b/tests/Sanity/net_err_suggests_fetch_with_cli/runtest.sh index ba7ed8a..bca1cc5 100755 --- a/tests/Sanity/net_err_suggests_fetch_with_cli/runtest.sh +++ b/tests/Sanity/net_err_suggests_fetch_with_cli/runtest.sh @@ -2,20 +2,17 @@ # vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k . /usr/share/beakerlib/beakerlib.sh || exit 1 -# For the test remote depenency, we use a TEST-NET-1 address (192.0.2.1) instead -# "needs-proxy.invalid" like upstream, to deal with potential catch-all DNS -# resolvers that redirect any invalid domain to loopback. These result in a -# connection refused (OS error) for any invalid host, but we need a network -# error for cargo to recommend using fetch-with-cli.SS -# To achieve it we use a documented test IP with a very short timeout that -# will simulate the same effect of unreachable host, causing cargo to suggest -# using the git fetch option. +# Use TEST-NET-1 address (192.0.2.1) instead of "needs-proxy.invalid" to avoid +# corporate DNS resolvers that redirect invalid domains to loopback, which would +# cause OS errors instead of network errors. Cargo only suggests git-fetch-with-cli +# for network errors, not OS errors. CRATE_NAME="foo" CRATE_VER="0.0.0" REMOTE_URL="https://192.0.2.1/git" +# Generate Cargo.toml with a git dependency pointing to an unreachable URL function generate_cargo_toml() { local dest_dir=$1 cat >> "$dest_dir/Cargo.toml" <> .cargo/config.toml <