summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/apiv2/20-containers.at4
-rw-r--r--test/e2e/common_test.go4
-rw-r--r--test/e2e/exec_test.go12
-rw-r--r--test/e2e/libpod_suite_remoteclient_test.go6
-rw-r--r--test/e2e/libpod_suite_test.go8
-rw-r--r--test/utils/podmantest_test.go2
-rw-r--r--test/utils/utils.go6
7 files changed, 29 insertions, 13 deletions
diff --git a/test/apiv2/20-containers.at b/test/apiv2/20-containers.at
index 7fb39b221..04e2fa64c 100644
--- a/test/apiv2/20-containers.at
+++ b/test/apiv2/20-containers.at
@@ -21,8 +21,8 @@ t GET libpod/containers/json?all=true 200 \
length=1 \
.[0].Id~[0-9a-f]\\{12\\} \
.[0].Image=$IMAGE \
- .[0].Command[0]="true" \
- .[0].State~\\\(exited\\\|stopped\\\) \
+ .[0].Cmd[0]="true" \
+ .[0].ContainerState~\\\(exited\\\|stopped\\\) \
.[0].ExitCode=0 \
.[0].IsInfra=false
diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go
index 8c4fe9223..d93ee8d3a 100644
--- a/test/e2e/common_test.go
+++ b/test/e2e/common_test.go
@@ -221,8 +221,8 @@ func PodmanTestCreateUtil(tempDir string, remote bool) *PodmanTestIntegration {
ociRuntime := os.Getenv("OCI_RUNTIME")
if ociRuntime == "" {
var err error
- ociRuntime, err = exec.LookPath("runc")
- // If we cannot find the runc binary, setting to something static as we have no way
+ ociRuntime, err = exec.LookPath("crun")
+ // If we cannot find the crun binary, setting to something static as we have no way
// to return an error. The tests will fail and point out that the runc binary could
// not be found nicely.
if err != nil {
diff --git a/test/e2e/exec_test.go b/test/e2e/exec_test.go
index 5d0d6e689..8b95794d2 100644
--- a/test/e2e/exec_test.go
+++ b/test/e2e/exec_test.go
@@ -244,15 +244,17 @@ var _ = Describe("Podman exec", func() {
})
It("podman exec preserve fds sanity check", func() {
- // TODO: add this test once crun adds the --preserve-fds flag for exec
- if strings.Contains(podmanTest.OCIRuntime, "crun") {
- Skip("Test only works on crun")
- }
setup := podmanTest.RunTopContainer("test1")
setup.WaitWithDefaultTimeout()
Expect(setup.ExitCode()).To(Equal(0))
- session := podmanTest.Podman([]string{"exec", "--preserve-fds", "1", "test1", "ls"})
+ devNull, err := os.Open("/dev/null")
+ Expect(err).To(BeNil())
+ defer devNull.Close()
+ files := []*os.File{
+ devNull,
+ }
+ session := podmanTest.PodmanExtraFiles([]string{"exec", "--preserve-fds", "1", "test1", "ls"}, files)
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
})
diff --git a/test/e2e/libpod_suite_remoteclient_test.go b/test/e2e/libpod_suite_remoteclient_test.go
index c87ff016a..b5da041ab 100644
--- a/test/e2e/libpod_suite_remoteclient_test.go
+++ b/test/e2e/libpod_suite_remoteclient_test.go
@@ -34,6 +34,12 @@ func (p *PodmanTestIntegration) Podman(args []string) *PodmanSessionIntegration
return &PodmanSessionIntegration{podmanSession}
}
+// PodmanExtraFiles is the exec call to podman on the filesystem and passes down extra files
+func (p *PodmanTestIntegration) PodmanExtraFiles(args []string, extraFiles []*os.File) *PodmanSessionIntegration {
+ podmanSession := p.PodmanAsUserBase(args, 0, 0, "", nil, false, false, nil, extraFiles)
+ return &PodmanSessionIntegration{podmanSession}
+}
+
// PodmanNoCache calls podman with out adding the imagecache
func (p *PodmanTestIntegration) PodmanNoCache(args []string) *PodmanSessionIntegration {
podmanSession := p.PodmanBase(args, false, true)
diff --git a/test/e2e/libpod_suite_test.go b/test/e2e/libpod_suite_test.go
index dc5e91c72..29a55980c 100644
--- a/test/e2e/libpod_suite_test.go
+++ b/test/e2e/libpod_suite_test.go
@@ -27,6 +27,12 @@ func (p *PodmanTestIntegration) Podman(args []string) *PodmanSessionIntegration
return &PodmanSessionIntegration{podmanSession}
}
+// PodmanExtraFiles is the exec call to podman on the filesystem and passes down extra files
+func (p *PodmanTestIntegration) PodmanExtraFiles(args []string, extraFiles []*os.File) *PodmanSessionIntegration {
+ podmanSession := p.PodmanAsUserBase(args, 0, 0, "", nil, false, false, extraFiles)
+ return &PodmanSessionIntegration{podmanSession}
+}
+
// PodmanNoCache calls the podman command with no configured imagecache
func (p *PodmanTestIntegration) PodmanNoCache(args []string) *PodmanSessionIntegration {
podmanSession := p.PodmanBase(args, false, true)
@@ -42,7 +48,7 @@ func (p *PodmanTestIntegration) PodmanNoEvents(args []string) *PodmanSessionInte
// PodmanAsUser is the exec call to podman on the filesystem with the specified uid/gid and environment
func (p *PodmanTestIntegration) PodmanAsUser(args []string, uid, gid uint32, cwd string, env []string) *PodmanSessionIntegration {
- podmanSession := p.PodmanAsUserBase(args, uid, gid, cwd, env, false, false)
+ podmanSession := p.PodmanAsUserBase(args, uid, gid, cwd, env, false, false, nil)
return &PodmanSessionIntegration{podmanSession}
}
diff --git a/test/utils/podmantest_test.go b/test/utils/podmantest_test.go
index 9620898af..387c8747c 100644
--- a/test/utils/podmantest_test.go
+++ b/test/utils/podmantest_test.go
@@ -23,7 +23,7 @@ var _ = Describe("PodmanTest test", func() {
FakeOutputs["check"] = []string{"check"}
os.Setenv("HOOK_OPTION", "hook_option")
env := os.Environ()
- session := podmanTest.PodmanAsUserBase([]string{"check"}, 1000, 1000, "", env, true, false)
+ session := podmanTest.PodmanAsUserBase([]string{"check"}, 1000, 1000, "", env, true, false, nil)
os.Unsetenv("HOOK_OPTION")
session.WaitWithDefaultTimeout()
Expect(session.Command.Process).ShouldNot(BeNil())
diff --git a/test/utils/utils.go b/test/utils/utils.go
index ad78d9792..6ab8604a4 100644
--- a/test/utils/utils.go
+++ b/test/utils/utils.go
@@ -65,7 +65,7 @@ func (p *PodmanTest) MakeOptions(args []string, noEvents, noCache bool) []string
// PodmanAsUserBase exec podman as user. uid and gid is set for credentials usage. env is used
// to record the env for debugging
-func (p *PodmanTest) PodmanAsUserBase(args []string, uid, gid uint32, cwd string, env []string, noEvents, noCache bool) *PodmanSession {
+func (p *PodmanTest) PodmanAsUserBase(args []string, uid, gid uint32, cwd string, env []string, noEvents, noCache bool, extraFiles []*os.File) *PodmanSession {
var command *exec.Cmd
podmanOptions := p.MakeOptions(args, noEvents, noCache)
podmanBinary := p.PodmanBinary
@@ -93,6 +93,8 @@ func (p *PodmanTest) PodmanAsUserBase(args []string, uid, gid uint32, cwd string
command.Dir = cwd
}
+ command.ExtraFiles = extraFiles
+
session, err := gexec.Start(command, GinkgoWriter, GinkgoWriter)
if err != nil {
Fail(fmt.Sprintf("unable to run podman command: %s\n%v", strings.Join(podmanOptions, " "), err))
@@ -102,7 +104,7 @@ func (p *PodmanTest) PodmanAsUserBase(args []string, uid, gid uint32, cwd string
// PodmanBase exec podman with default env.
func (p *PodmanTest) PodmanBase(args []string, noEvents, noCache bool) *PodmanSession {
- return p.PodmanAsUserBase(args, 0, 0, "", nil, noEvents, noCache)
+ return p.PodmanAsUserBase(args, 0, 0, "", nil, noEvents, noCache, nil)
}
// WaitForContainer waits on a started container