mirror of https://github.com/containers/podman.git
Merge pull request #16684 from sstosh/e2e-proxy
e2e: fix e2e tests in proxy environment
This commit is contained in:
commit
1b62e9049e
|
@ -434,7 +434,8 @@ func (p *PodmanTestIntegration) RunTopContainer(name string) *PodmanSessionInteg
|
|||
// RunTopContainerWithArgs runs a simple container in the background that
|
||||
// runs top. If the name passed != "", it will have a name, command args can also be passed in
|
||||
func (p *PodmanTestIntegration) RunTopContainerWithArgs(name string, args []string) *PodmanSessionIntegration {
|
||||
var podmanArgs = []string{"run"}
|
||||
// In proxy environment, some tests need to the --http-proxy=false option (#16684)
|
||||
var podmanArgs = []string{"run", "--http-proxy=false"}
|
||||
if name != "" {
|
||||
podmanArgs = append(podmanArgs, "--name", name)
|
||||
}
|
||||
|
@ -476,6 +477,17 @@ func (p *PodmanTestIntegration) RunNginxWithHealthCheck(name string) (*PodmanSes
|
|||
return session, session.OutputToString()
|
||||
}
|
||||
|
||||
// RunContainerWithNetworkTest runs the fedoraMinimal curl with the specified network mode.
|
||||
func (p *PodmanTestIntegration) RunContainerWithNetworkTest(mode string) *PodmanSessionIntegration {
|
||||
var podmanArgs = []string{"run"}
|
||||
if mode != "" {
|
||||
podmanArgs = append(podmanArgs, "--network", mode)
|
||||
}
|
||||
podmanArgs = append(podmanArgs, fedoraMinimal, "curl", "-k", "-o", "/dev/null", "http://www.podman.io:80")
|
||||
session := p.Podman(podmanArgs)
|
||||
return session
|
||||
}
|
||||
|
||||
func (p *PodmanTestIntegration) RunLsContainerInPod(name, pod string) (*PodmanSessionIntegration, int, string) {
|
||||
var podmanArgs = []string{"run", "--pod", pod}
|
||||
if name != "" {
|
||||
|
|
|
@ -1251,7 +1251,8 @@ USER test1`
|
|||
|
||||
ctrName := "gen-kube-env-ctr"
|
||||
podName := "gen-kube-env"
|
||||
session1 := podmanTest.Podman([]string{"run", "-d", "--pod", "new:" + podName, "--name", ctrName,
|
||||
// In proxy environment, this test needs to the --http-proxy=false option (#16684)
|
||||
session1 := podmanTest.Podman([]string{"run", "-d", "--http-proxy=false", "--pod", "new:" + podName, "--name", ctrName,
|
||||
"-e", "FOO=bar",
|
||||
"-e", "HELLO=WORLD",
|
||||
"alpine", "top"})
|
||||
|
|
|
@ -42,38 +42,37 @@ var _ = Describe("Podman run networking", func() {
|
|||
})
|
||||
|
||||
It("podman run network connection with default bridge", func() {
|
||||
session := podmanTest.Podman([]string{"run", "-dt", ALPINE, "wget", "www.podman.io"})
|
||||
session.Wait(90)
|
||||
session := podmanTest.RunContainerWithNetworkTest("")
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
})
|
||||
|
||||
It("podman run network connection with host", func() {
|
||||
session := podmanTest.Podman([]string{"run", "-dt", "--network", "host", ALPINE, "wget", "www.podman.io"})
|
||||
session.Wait(90)
|
||||
session := podmanTest.RunContainerWithNetworkTest("host")
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
})
|
||||
|
||||
It("podman run network connection with default", func() {
|
||||
session := podmanTest.Podman([]string{"run", "--network", "default", ALPINE, "wget", "www.podman.io"})
|
||||
session := podmanTest.RunContainerWithNetworkTest("default")
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
})
|
||||
|
||||
It("podman run network connection with none", func() {
|
||||
session := podmanTest.Podman([]string{"run", "--network", "none", ALPINE, "wget", "www.podman.io"})
|
||||
session := podmanTest.RunContainerWithNetworkTest("none")
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(1))
|
||||
Expect(session.ErrorToString()).To(ContainSubstring("wget: bad address 'www.podman.io'"))
|
||||
if _, found := os.LookupEnv("http_proxy"); found {
|
||||
Expect(session).Should(Exit(5))
|
||||
Expect(session.ErrorToString()).To(ContainSubstring("Could not resolve proxy:"))
|
||||
} else {
|
||||
Expect(session).Should(Exit(6))
|
||||
Expect(session.ErrorToString()).To(ContainSubstring("Could not resolve host: www.podman.io"))
|
||||
}
|
||||
})
|
||||
|
||||
It("podman run network connection with private", func() {
|
||||
session := podmanTest.Podman([]string{"run", "--network", "private", ALPINE, "wget", "www.podman.io"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
})
|
||||
|
||||
It("podman run network connection with loopback", func() {
|
||||
session := podmanTest.Podman([]string{"run", "--network", "host", ALPINE, "wget", "www.podman.io"})
|
||||
session := podmanTest.RunContainerWithNetworkTest("private")
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
})
|
||||
|
|
|
@ -65,6 +65,8 @@ var _ = Describe("Systemd activate", func() {
|
|||
addr := net.JoinHostPort(host, strconv.Itoa(port))
|
||||
|
||||
activateSession := testUtils.StartSystemExec(activate, []string{
|
||||
"-E", "http_proxy", "-E", "https_proxy", "-E", "no_proxy",
|
||||
"-E", "HTTP_PROXY", "-E", "HTTPS_PROXY", "-E", "NO_PROXY",
|
||||
"--listen", addr,
|
||||
podmanTest.PodmanBinary,
|
||||
"--root=" + filepath.Join(tempDir, "server_root"),
|
||||
|
|
Loading…
Reference in New Issue