summaryrefslogtreecommitdiff
path: root/test/utils
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2020-04-09 09:56:26 +0200
committerGiuseppe Scrivano <gscrivan@redhat.com>2020-04-09 10:17:42 +0200
commitd3cfa7a23c2343581185b8ddf9bab6f2ccf9eccc (patch)
treee30b6b865dc0f729ebb46cda232cd7dca0c80280 /test/utils
parent291ad7fbd9797340015b71b448c6637669176878 (diff)
downloadpodman-d3cfa7a23c2343581185b8ddf9bab6f2ccf9eccc.tar.gz
podman-d3cfa7a23c2343581185b8ddf9bab6f2ccf9eccc.tar.bz2
podman-d3cfa7a23c2343581185b8ddf9bab6f2ccf9eccc.zip
test: fix exec preserve-fds test
it specifies a fd is passed down but we are not really doing it, and it triggers the wrong fd to be closed by Podman after the OCI runtime invocation. Closes: https://github.com/containers/libpod/issues/5769 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'test/utils')
-rw-r--r--test/utils/podmantest_test.go2
-rw-r--r--test/utils/utils.go6
2 files changed, 5 insertions, 3 deletions
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