Run integrations test with remote-client

Add the ability to run the integration (ginkgo) suite using
the remote client.

Only the images_test.go file is run right now; all the rest are
isolated with a // +build !remotelinux.  As more content is
developed for the remote client, we can unblock the files and
just block single tests as needed.

Signed-off-by: baude <bbaude@redhat.com>
This commit is contained in:
baude
2019-01-14 13:23:13 -06:00
parent 30f115a960
commit b30a56c156
89 changed files with 658 additions and 218 deletions

View File

@ -33,10 +33,13 @@ type PodmanTestCommon interface {
// PodmanTest struct for command line options
type PodmanTest struct {
PodmanMakeOptions func(args []string) []string
PodmanBinary string
ArtifactPath string
TempDir string
PodmanMakeOptions func(args []string) []string
PodmanBinary string
ArtifactPath string
TempDir string
RemoteTest bool
RemotePodmanBinary string
VarlinkSession *os.Process
}
// PodmanSession wraps the gexec.session so we can extend it
@ -61,17 +64,20 @@ func (p *PodmanTest) MakeOptions(args []string) []string {
func (p *PodmanTest) PodmanAsUserBase(args []string, uid, gid uint32, env []string) *PodmanSession {
var command *exec.Cmd
podmanOptions := p.MakeOptions(args)
podmanBinary := p.PodmanBinary
if p.RemoteTest {
podmanBinary = p.RemotePodmanBinary
}
if env == nil {
fmt.Printf("Running: %s %s\n", p.PodmanBinary, strings.Join(podmanOptions, " "))
fmt.Printf("Running: %s %s\n", podmanBinary, strings.Join(podmanOptions, " "))
} else {
fmt.Printf("Running: (env: %v) %s %s\n", env, p.PodmanBinary, strings.Join(podmanOptions, " "))
fmt.Printf("Running: (env: %v) %s %s\n", env, podmanBinary, strings.Join(podmanOptions, " "))
}
if uid != 0 || gid != 0 {
nsEnterOpts := append([]string{"--userspec", fmt.Sprintf("%d:%d", uid, gid), "/", p.PodmanBinary}, podmanOptions...)
nsEnterOpts := append([]string{"--userspec", fmt.Sprintf("%d:%d", uid, gid), "/", podmanBinary}, podmanOptions...)
command = exec.Command("chroot", nsEnterOpts...)
} else {
command = exec.Command(p.PodmanBinary, podmanOptions...)
command = exec.Command(podmanBinary, podmanOptions...)
}
if env != nil {
command.Env = env