From 92d2bb7f6bdac7d38f1aed1f17d4003096960b83 Mon Sep 17 00:00:00 2001 From: Tony Breeds Date: Tue, 31 Oct 2023 17:09:51 -0500 Subject: [PATCH] [testinfra] Add port into curl's --resolve arg. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The curl manpage explains that port isn't optional: --resolve <[+]host:port:addr[,addr]...> Provide a custom address for a specific host and port pair. Us‐ ing this, you can make the curl requests(s) use a specified ad‐ dress and prevent the otherwise normally resolved address to be used. Consider it a sort of /etc/hosts alternative provided on the command line. The port number should be the number used for the specific protocol the host will be used for. It means you need several entries if you want to provide address for the same host but different ports. Change-Id: I40117768bbc149678a69905a8f6ecd3519301ce1 --- testinfra/test_mirror.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testinfra/test_mirror.py b/testinfra/test_mirror.py index 359383ce9f..fa32a3ea96 100644 --- a/testinfra/test_mirror.py +++ b/testinfra/test_mirror.py @@ -25,7 +25,7 @@ def test_apache(host): def _run_cmd(host, port, scheme='https', url='', curl_opt=''): hostname = host.backend.get_hostname() - return f'curl {curl_opt} --resolve {hostname}:127.0.0.1 {scheme}://{hostname}:{port}{url}' + return f'curl {curl_opt} --resolve {hostname}:{port}:127.0.0.1 {scheme}://{hostname}:{port}{url}' def test_base_mirror(host): # base mirror