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>
This commit is contained in:
Toshiki Sonoda
2022-09-08 11:18:10 +09:00
parent ea3e7ef073
commit 626ee118c8

View File

@ -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 {