mirror of
https://github.com/containers/podman.git
synced 2025-06-03 03:07:56 +08:00
tests: change return type for PodmanAsUser to PodmanTestIntegration
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
@ -181,6 +181,12 @@ func (p *PodmanTestIntegration) Podman(args []string) *PodmanSessionIntegration
|
|||||||
return &PodmanSessionIntegration{podmanSession}
|
return &PodmanSessionIntegration{podmanSession}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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, env []string) *PodmanSessionIntegration {
|
||||||
|
podmanSession := p.PodmanAsUserBase(args, uid, gid, env)
|
||||||
|
return &PodmanSessionIntegration{podmanSession}
|
||||||
|
}
|
||||||
|
|
||||||
// PodmanPID execs podman and returns its PID
|
// PodmanPID execs podman and returns its PID
|
||||||
func (p *PodmanTestIntegration) PodmanPID(args []string) (*PodmanSessionIntegration, int) {
|
func (p *PodmanTestIntegration) PodmanPID(args []string) (*PodmanSessionIntegration, int) {
|
||||||
podmanOptions := p.MakeOptions(args)
|
podmanOptions := p.MakeOptions(args)
|
||||||
|
@ -19,11 +19,11 @@ var _ = Describe("PodmanTest test", func() {
|
|||||||
FakeOutputs = make(map[string][]string)
|
FakeOutputs = make(map[string][]string)
|
||||||
})
|
})
|
||||||
|
|
||||||
It("Test PodmanAsUser", func() {
|
It("Test PodmanAsUserBase", func() {
|
||||||
FakeOutputs["check"] = []string{"check"}
|
FakeOutputs["check"] = []string{"check"}
|
||||||
os.Setenv("HOOK_OPTION", "hook_option")
|
os.Setenv("HOOK_OPTION", "hook_option")
|
||||||
env := os.Environ()
|
env := os.Environ()
|
||||||
session := podmanTest.PodmanAsUser([]string{"check"}, 1000, 1000, env)
|
session := podmanTest.PodmanAsUserBase([]string{"check"}, 1000, 1000, env)
|
||||||
os.Unsetenv("HOOK_OPTION")
|
os.Unsetenv("HOOK_OPTION")
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session.Command.Process).ShouldNot(BeNil())
|
Expect(session.Command.Process).ShouldNot(BeNil())
|
||||||
|
@ -56,9 +56,9 @@ func (p *PodmanTest) MakeOptions(args []string) []string {
|
|||||||
return p.PodmanMakeOptions(args)
|
return p.PodmanMakeOptions(args)
|
||||||
}
|
}
|
||||||
|
|
||||||
// PodmanAsUser exec podman as user. uid and gid is set for credentials useage. env is used
|
// PodmanAsUserBase exec podman as user. uid and gid is set for credentials useage. env is used
|
||||||
// to record the env for debugging
|
// to record the env for debugging
|
||||||
func (p *PodmanTest) PodmanAsUser(args []string, uid, gid uint32, env []string) *PodmanSession {
|
func (p *PodmanTest) PodmanAsUserBase(args []string, uid, gid uint32, env []string) *PodmanSession {
|
||||||
var command *exec.Cmd
|
var command *exec.Cmd
|
||||||
podmanOptions := p.MakeOptions(args)
|
podmanOptions := p.MakeOptions(args)
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ func (p *PodmanTest) PodmanAsUser(args []string, uid, gid uint32, env []string)
|
|||||||
|
|
||||||
// PodmanBase exec podman with default env.
|
// PodmanBase exec podman with default env.
|
||||||
func (p *PodmanTest) PodmanBase(args []string) *PodmanSession {
|
func (p *PodmanTest) PodmanBase(args []string) *PodmanSession {
|
||||||
return p.PodmanAsUser(args, 0, 0, nil)
|
return p.PodmanAsUserBase(args, 0, 0, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
// WaitForContainer waits on a started container
|
// WaitForContainer waits on a started container
|
||||||
|
Reference in New Issue
Block a user