netavark e2e tests

enabled e2e tests for netavark

Signed-off-by: Brent Baude <bbaude@redhat.com>
This commit is contained in:
Brent Baude
2022-01-05 13:10:56 -06:00
parent c2d0011b72
commit 7d3ad6081f
19 changed files with 327 additions and 192 deletions

View File

@ -12,12 +12,34 @@ import (
"strings"
"time"
"github.com/sirupsen/logrus"
"github.com/containers/storage/pkg/parsers/kernel"
. "github.com/onsi/ginkgo" //nolint:golint,stylecheck
. "github.com/onsi/gomega" //nolint:golint,stylecheck
. "github.com/onsi/gomega/gexec" //nolint:golint,stylecheck
)
type NetworkBackend int
const (
// Container Networking backend
CNI NetworkBackend = iota
// Netavark network backend
Netavark NetworkBackend = iota
)
func (n NetworkBackend) ToString() string {
switch n {
case CNI:
return "cni"
case Netavark:
return "netavark"
}
logrus.Errorf("unknown network backend: %q", n)
return ""
}
var (
DefaultWaitTimeout = 90
OSReleasePath = "/etc/os-release"
@ -34,17 +56,18 @@ type PodmanTestCommon interface {
// PodmanTest struct for command line options
type PodmanTest struct {
PodmanMakeOptions func(args []string, noEvents, noCache bool) []string
ImageCacheDir string
ImageCacheFS string
NetworkBackend NetworkBackend
PodmanBinary string
TempDir string
RemoteTest bool
PodmanMakeOptions func(args []string, noEvents, noCache bool) []string
RemoteCommand *exec.Cmd
RemotePodmanBinary string
RemoteSession *os.Process
RemoteSocket string
RemoteSocketLock string // If not "", should be removed _after_ RemoteSocket is removed
RemoteCommand *exec.Cmd
ImageCacheDir string
ImageCacheFS string
RemoteTest bool
TempDir string
}
// PodmanSession wraps the gexec.session so we can extend it
@ -73,8 +96,10 @@ func (p *PodmanTest) PodmanAsUserBase(args []string, uid, gid uint32, cwd string
if p.RemoteTest {
podmanBinary = p.RemotePodmanBinary
}
runCmd := append(wrapper, podmanBinary)
if p.NetworkBackend == Netavark {
runCmd = append(runCmd, []string{"--network-backend", "netavark"}...)
}
if p.RemoteTest {
podmanOptions = append([]string{"--remote", "--url", p.RemoteSocket}, podmanOptions...)
}