From 9272cabd388d37c2828e6d87f265a4cfa3f2b51a Mon Sep 17 00:00:00 2001 From: Toshiki Sonoda Date: Tue, 31 Jan 2023 16:55:11 +0900 Subject: [PATCH] e2e: fix run_staticip_test about no_proxy http.Get() could not recognize no_proxy with "ginkgo -nodes ". Therefore, we set http.Client not to use a proxy instead of os.Setenv(). Fixes #17135 Signed-off-by: Toshiki Sonoda --- test/e2e/run_staticip_test.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/e2e/run_staticip_test.go b/test/e2e/run_staticip_test.go index 057fbf7754..559dcfd93f 100644 --- a/test/e2e/run_staticip_test.go +++ b/test/e2e/run_staticip_test.go @@ -105,15 +105,15 @@ var _ = Describe("Podman run with --ip flag", func() { result.WaitWithDefaultTimeout() Expect(result).Should(Exit(0)) - // We need to set "no_proxy" in proxy environment - if env, found := os.LookupEnv("no_proxy"); found { - defer os.Setenv("no_proxy", env) - } else { - defer os.Unsetenv("no_proxy") + // This test should not use a proxy + client := &http.Client{ + Transport: &http.Transport{ + Proxy: nil, + }, } - os.Setenv("no_proxy", ip) + for retries := 20; retries > 0; retries-- { - response, err := http.Get(fmt.Sprintf("http://%s", ip)) + response, err := client.Get(fmt.Sprintf("http://%s", ip)) if err == nil && response.StatusCode == http.StatusOK { break }