From 9f8d002e1f9630207314c18b2048d6333619191f Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Fri, 24 Apr 2020 11:52:11 +0200 Subject: test: enable some run_test.go tests that pass now Signed-off-by: Giuseppe Scrivano --- test/e2e/run_test.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'test/e2e') diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go index c84bbe91f..df97ddf69 100644 --- a/test/e2e/run_test.go +++ b/test/e2e/run_test.go @@ -29,7 +29,6 @@ var _ = Describe("Podman run", func() { ) BeforeEach(func() { - Skip(v2fail) tempdir, err = CreateTempDirInTempDir() if err != nil { os.Exit(1) @@ -252,6 +251,7 @@ var _ = Describe("Podman run", func() { }) It("podman run --host-env environment test", func() { + Skip(v2fail) os.Setenv("FOO", "BAR") session := podmanTest.Podman([]string{"run", "--rm", "--env-host", ALPINE, "printenv", "FOO"}) session.WaitWithDefaultTimeout() @@ -469,6 +469,7 @@ var _ = Describe("Podman run", func() { }) It("podman run log-opt", func() { + Skip(v2fail) log := filepath.Join(podmanTest.TempDir, "/container.log") session := podmanTest.Podman([]string{"run", "--rm", "--log-opt", fmt.Sprintf("path=%s", log), ALPINE, "ls"}) session.WaitWithDefaultTimeout() @@ -565,6 +566,7 @@ var _ = Describe("Podman run", func() { }) It("podman run with group-add", func() { + Skip(v2fail) SkipIfRootless() session := podmanTest.Podman([]string{"run", "--rm", "--group-add=audio", "--group-add=nogroup", "--group-add=777", ALPINE, "id"}) session.WaitWithDefaultTimeout() @@ -708,6 +710,7 @@ USER mail` }) It("podman run --volumes-from flag with built-in volumes", func() { + Skip(v2fail) session := podmanTest.Podman([]string{"create", redis, "sh"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) @@ -802,6 +805,7 @@ USER mail` }) It("podman run --pod automatically", func() { + Skip(v2fail) session := podmanTest.Podman([]string{"run", "--pod", "new:foobar", ALPINE, "ls"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) @@ -874,6 +878,7 @@ USER mail` }) It("podman run --http-proxy test", func() { + Skip(v2fail) os.Setenv("http_proxy", "1.2.3.4") session := podmanTest.Podman([]string{"run", "--rm", ALPINE, "printenv", "http_proxy"}) session.WaitWithDefaultTimeout() @@ -932,6 +937,7 @@ USER mail` }) It("podman run with cgroups=disabled runs without cgroups", func() { + Skip(v2fail) SkipIfRemote() SkipIfRootless() // Only works on crun -- cgit v1.2.3-54-g00ecf From 2e6a62fc380976b06fc9a57892b4070528b94b60 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Fri, 24 Apr 2020 11:56:19 +0200 Subject: podman: fix --cgroups=disabled Signed-off-by: Giuseppe Scrivano --- cmd/podman/common/specgen.go | 6 +++--- test/e2e/run_test.go | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'test/e2e') diff --git a/cmd/podman/common/specgen.go b/cmd/podman/common/specgen.go index b90030f7f..fda11c0af 100644 --- a/cmd/podman/common/specgen.go +++ b/cmd/podman/common/specgen.go @@ -119,13 +119,13 @@ func getIOLimits(s *specgen.SpecGenerator, c *ContainerCLIOpts, args []string) ( func getPidsLimits(s *specgen.SpecGenerator, c *ContainerCLIOpts, args []string) (*specs.LinuxPids, error) { pids := &specs.LinuxPids{} hasLimits := false + if c.CGroupsMode == "disabled" && c.PIDsLimit > 0 { + return nil, nil + } if c.PIDsLimit > 0 { pids.Limit = c.PIDsLimit hasLimits = true } - if c.CGroupsMode == "disabled" && c.PIDsLimit > 0 { - s.ResourceLimits.Pids.Limit = -1 - } if !hasLimits { return nil, nil } diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go index df97ddf69..92db37096 100644 --- a/test/e2e/run_test.go +++ b/test/e2e/run_test.go @@ -937,7 +937,6 @@ USER mail` }) It("podman run with cgroups=disabled runs without cgroups", func() { - Skip(v2fail) SkipIfRemote() SkipIfRootless() // Only works on crun -- cgit v1.2.3-54-g00ecf From 543d5f17405e65386bd848d9f4d06cfbce27ef29 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Fri, 24 Apr 2020 12:15:33 +0200 Subject: test: fix --host-env test Signed-off-by: Giuseppe Scrivano --- test/e2e/run_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test/e2e') diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go index 92db37096..735fc1d5d 100644 --- a/test/e2e/run_test.go +++ b/test/e2e/run_test.go @@ -251,15 +251,15 @@ var _ = Describe("Podman run", func() { }) It("podman run --host-env environment test", func() { - Skip(v2fail) - os.Setenv("FOO", "BAR") - session := podmanTest.Podman([]string{"run", "--rm", "--env-host", ALPINE, "printenv", "FOO"}) + env := append(os.Environ(), "FOO=BAR") + session := podmanTest.PodmanAsUser([]string{"run", "--rm", "--env-host", ALPINE, "/bin/printenv", "FOO"}, 0, 0, "", env) + session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) match, _ := session.GrepString("BAR") Expect(match).Should(BeTrue()) - session = podmanTest.Podman([]string{"run", "--rm", "--env", "FOO=BAR1", "--env-host", ALPINE, "printenv", "FOO"}) + session = podmanTest.PodmanAsUser([]string{"run", "--rm", "--env", "FOO=BAR1", "--env-host", ALPINE, "/bin/printenv", "FOO"}, 0, 0, "", env) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) match, _ = session.GrepString("BAR1") -- cgit v1.2.3-54-g00ecf From a1f73d095400f13999e61578567f338a9f13a008 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Fri, 24 Apr 2020 12:25:18 +0200 Subject: podman: fix podman --group-add Signed-off-by: Giuseppe Scrivano --- cmd/podman/common/specgen.go | 1 + test/e2e/run_test.go | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) (limited to 'test/e2e') diff --git a/cmd/podman/common/specgen.go b/cmd/podman/common/specgen.go index fda11c0af..e14fd78b4 100644 --- a/cmd/podman/common/specgen.go +++ b/cmd/podman/common/specgen.go @@ -449,6 +449,7 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *ContainerCLIOpts, args []string } s.CgroupParent = c.CGroupParent s.CgroupsMode = c.CGroupsMode + s.Groups = c.GroupAdd // TODO WTF //cgroup := &cc.CgroupConfig{ // Cgroupns: c.String("cgroupns"), diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go index 735fc1d5d..6386b8a70 100644 --- a/test/e2e/run_test.go +++ b/test/e2e/run_test.go @@ -566,7 +566,6 @@ var _ = Describe("Podman run", func() { }) It("podman run with group-add", func() { - Skip(v2fail) SkipIfRootless() session := podmanTest.Podman([]string{"run", "--rm", "--group-add=audio", "--group-add=nogroup", "--group-add=777", ALPINE, "id"}) session.WaitWithDefaultTimeout() -- cgit v1.2.3-54-g00ecf From 145d74716c9cbc8d6c83be5a8f6a575543d10d06 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Fri, 24 Apr 2020 12:45:00 +0200 Subject: podman: fix --http-proxy Signed-off-by: Giuseppe Scrivano --- cmd/podman/common/specgen.go | 16 ++++++++++++++++ test/e2e/run_test.go | 1 - 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'test/e2e') diff --git a/cmd/podman/common/specgen.go b/cmd/podman/common/specgen.go index e14fd78b4..9e8a271ae 100644 --- a/cmd/podman/common/specgen.go +++ b/cmd/podman/common/specgen.go @@ -288,7 +288,23 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *ContainerCLIOpts, args []string if c.EnvHost { env = envLib.Join(env, osEnv) + } else if c.HTTPProxy { + for _, envSpec := range []string{ + "http_proxy", + "HTTP_PROXY", + "https_proxy", + "HTTPS_PROXY", + "ftp_proxy", + "FTP_PROXY", + "no_proxy", + "NO_PROXY", + } { + if v, ok := osEnv[envSpec]; ok { + env[envSpec] = v + } + } } + // env-file overrides any previous variables for _, f := range c.EnvFile { fileEnv, err := envLib.ParseFile(f) diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go index 6386b8a70..7745bcf6a 100644 --- a/test/e2e/run_test.go +++ b/test/e2e/run_test.go @@ -877,7 +877,6 @@ USER mail` }) It("podman run --http-proxy test", func() { - Skip(v2fail) os.Setenv("http_proxy", "1.2.3.4") session := podmanTest.Podman([]string{"run", "--rm", ALPINE, "printenv", "http_proxy"}) session.WaitWithDefaultTimeout() -- cgit v1.2.3-54-g00ecf From 3eeb03d1f970478961acf21cecfdf90d5a75043f Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Fri, 24 Apr 2020 12:50:13 +0200 Subject: podman: fix --log-opt=path=%s Signed-off-by: Giuseppe Scrivano --- cmd/podman/common/specgen.go | 9 ++++++++- test/e2e/run_test.go | 1 - 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'test/e2e') diff --git a/cmd/podman/common/specgen.go b/cmd/podman/common/specgen.go index 9e8a271ae..abec1213c 100644 --- a/cmd/podman/common/specgen.go +++ b/cmd/podman/common/specgen.go @@ -602,7 +602,14 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *ContainerCLIOpts, args []string if len(split) < 2 { return errors.Errorf("invalid log option %q", o) } - logOpts[split[0]] = split[1] + switch { + case split[0] == "driver": + s.LogConfiguration.Driver = split[1] + case split[0] == "path": + s.LogConfiguration.Path = split[1] + default: + logOpts[split[0]] = split[1] + } } s.LogConfiguration.Options = logOpts s.Name = c.Name diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go index 7745bcf6a..7d4039819 100644 --- a/test/e2e/run_test.go +++ b/test/e2e/run_test.go @@ -469,7 +469,6 @@ var _ = Describe("Podman run", func() { }) It("podman run log-opt", func() { - Skip(v2fail) log := filepath.Join(podmanTest.TempDir, "/container.log") session := podmanTest.Podman([]string{"run", "--rm", "--log-opt", fmt.Sprintf("path=%s", log), ALPINE, "ls"}) session.WaitWithDefaultTimeout() -- cgit v1.2.3-54-g00ecf