From 626ee118c8b39e2cd17b2d88e651d2e39fa60ec4 Mon Sep 17 00:00:00 2001
From: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
Date: Thu, 8 Sep 2022 11:18:10 +0900
Subject: e2e: fix run_staticip_test in proxy environment

`Podman run two containers with the same IP [It]`
This test will be failed in proxy environment.
We need to set the static ip to no_proxy.

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
---
 test/e2e/run_staticip_test.go | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/test/e2e/run_staticip_test.go b/test/e2e/run_staticip_test.go
index 8207f6d0b..12783cd29 100644
--- a/test/e2e/run_staticip_test.go
+++ b/test/e2e/run_staticip_test.go
@@ -105,6 +105,13 @@ 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")
+		}
+		os.Setenv("no_proxy", ip)
 		for retries := 20; retries > 0; retries-- {
 			response, err := http.Get(fmt.Sprintf("http://%s", ip))
 			if err == nil && response.StatusCode == http.StatusOK {
-- 
cgit v1.2.3-54-g00ecf