e2e: fix e2e tests in proxy environment

- podman generate kube inheritents the proxy environment valiable by default.
  Therefore, Env field is not empty if it is set.

- systemd-socket-acrivate needs to pass an proxy environment variable.

- busybox wget with an proxy doesn't work.
  Network tests should use not wget but curl.
  https://gitlab.alpinelinux.org/alpine/aports/-/issues/10446

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
This commit is contained in:
Toshiki Sonoda
2022-11-30 10:42:21 +09:00
parent e15ffc1a76
commit 86f4bd4f54
4 changed files with 31 additions and 17 deletions

View File

@ -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 != "" {