Skip to content

Commit 5b6a03f

Browse files
Merge pull request #16763 from sstosh/e2e-http_proxy
e2e: keeps the http_proxy value
2 parents f1e167d + 8b87665 commit 5b6a03f

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

test/e2e/build_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,11 @@ var _ = Describe("Podman build", func() {
300300
})
301301

302302
It("podman build --http_proxy flag", func() {
303+
if env, found := os.LookupEnv("http_proxy"); found {
304+
defer os.Setenv("http_proxy", env)
305+
} else {
306+
defer os.Unsetenv("http_proxy")
307+
}
303308
os.Setenv("http_proxy", "1.2.3.4")
304309
if IsRemote() {
305310
podmanTest.StopRemoteService()
@@ -316,7 +321,6 @@ RUN printenv http_proxy`, ALPINE)
316321
session.Wait(120)
317322
Expect(session).Should(Exit(0))
318323
Expect(session.OutputToString()).To(ContainSubstring("1.2.3.4"))
319-
os.Unsetenv("http_proxy")
320324
})
321325

322326
It("podman build relay exit code to process", func() {

test/e2e/run_env_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@ ENV hello=world
121121
})
122122

123123
It("podman run --http-proxy test", func() {
124+
if env, found := os.LookupEnv("http_proxy"); found {
125+
defer os.Setenv("http_proxy", env)
126+
} else {
127+
defer os.Unsetenv("http_proxy")
128+
}
124129
os.Setenv("http_proxy", "1.2.3.4")
125130
if IsRemote() {
126131
podmanTest.StopRemoteService()
@@ -140,12 +145,10 @@ ENV hello=world
140145
session.WaitWithDefaultTimeout()
141146
Expect(session).Should(Exit(0))
142147
Expect(session.OutputToString()).To(ContainSubstring("5.6.7.8"))
143-
os.Unsetenv("http_proxy")
144148

145149
session = podmanTest.Podman([]string{"run", "--http-proxy=false", "--env", "http_proxy=5.6.7.8", ALPINE, "printenv", "http_proxy"})
146150
session.WaitWithDefaultTimeout()
147151
Expect(session).Should(Exit(0))
148152
Expect(session.OutputToString()).To(ContainSubstring("5.6.7.8"))
149-
os.Unsetenv("http_proxy")
150153
})
151154
})

0 commit comments

Comments
 (0)