summaryrefslogtreecommitdiff
path: root/test/e2e/common_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'test/e2e/common_test.go')
-rw-r--r--test/e2e/common_test.go44
1 files changed, 21 insertions, 23 deletions
diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go
index 160af1bd5..e12edad49 100644
--- a/test/e2e/common_test.go
+++ b/test/e2e/common_test.go
@@ -1,7 +1,6 @@
package integration
import (
- "encoding/json"
"fmt"
"io/ioutil"
"math/rand"
@@ -21,9 +20,11 @@ import (
"github.com/containers/storage"
"github.com/containers/storage/pkg/reexec"
"github.com/containers/storage/pkg/stringid"
+ jsoniter "github.com/json-iterator/go"
+ "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
- "github.com/onsi/gomega/gexec"
+ . "github.com/onsi/gomega/gexec"
"github.com/pkg/errors"
)
@@ -35,7 +36,7 @@ var (
INTEGRATION_ROOT string
CGROUP_MANAGER = "systemd"
ARTIFACT_DIR = "/tmp/.artifacts"
- RESTORE_IMAGES = []string{ALPINE, BB}
+ RESTORE_IMAGES = []string{ALPINE, BB, nginx}
defaultWaitTimeout = 90
)
@@ -53,6 +54,7 @@ type PodmanTestIntegration struct {
Host HostOS
Timings []string
TmpDir string
+ RemoteStartErr error
}
var LockTmpDir string
@@ -259,12 +261,12 @@ func PodmanTestCreateUtil(tempDir string, remote bool) *PodmanTestIntegration {
p.PodmanTest.RemotePodmanBinary = podmanRemoteBinary
uuid := stringid.GenerateNonCryptoID()
if !rootless.IsRootless() {
- p.VarlinkEndpoint = fmt.Sprintf("unix:/run/podman/io.podman-%s", uuid)
+ p.RemoteSocket = fmt.Sprintf("unix:/run/podman/podman-%s.sock", uuid)
} else {
runtimeDir := os.Getenv("XDG_RUNTIME_DIR")
- socket := fmt.Sprintf("io.podman-%s", uuid)
+ socket := fmt.Sprintf("podman-%s.sock", uuid)
fqpath := filepath.Join(runtimeDir, socket)
- p.VarlinkEndpoint = fmt.Sprintf("unix:%s", fqpath)
+ p.RemoteSocket = fmt.Sprintf("unix:%s", fqpath)
}
}
@@ -314,7 +316,7 @@ func (p *PodmanTestIntegration) createArtifact(image string) {
// image and returns json
func (s *PodmanSessionIntegration) InspectImageJSON() []inspect.ImageData {
var i []inspect.ImageData
- err := json.Unmarshal(s.Out.Contents(), &i)
+ err := jsoniter.Unmarshal(s.Out.Contents(), &i)
Expect(err).To(BeNil())
return i
}
@@ -324,7 +326,7 @@ func (p *PodmanTestIntegration) InspectContainer(name string) []define.InspectCo
cmd := []string{"inspect", name}
session := p.Podman(cmd)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
return session.InspectContainerToJSON()
}
@@ -419,7 +421,7 @@ func (p *PodmanTestIntegration) PodmanPID(args []string) (*PodmanSessionIntegrat
podmanOptions := p.MakeOptions(args, false, false)
fmt.Printf("Running: %s %s\n", p.PodmanBinary, strings.Join(podmanOptions, " "))
command := exec.Command(p.PodmanBinary, podmanOptions...)
- session, err := gexec.Start(command, GinkgoWriter, GinkgoWriter)
+ session, err := Start(command, GinkgoWriter, GinkgoWriter)
if err != nil {
Fail(fmt.Sprintf("unable to run podman command: %s", strings.Join(podmanOptions, " ")))
}
@@ -441,7 +443,7 @@ func (p *PodmanTestIntegration) Cleanup() {
session := p.Podman([]string{"rm", "-fa"})
session.Wait(90)
- p.StopVarlink()
+ p.StopRemoteService()
// Nuke tempdir
if err := os.RemoveAll(p.TempDir); err != nil {
fmt.Printf("%q\n", err)
@@ -451,17 +453,6 @@ func (p *PodmanTestIntegration) Cleanup() {
resetRegistriesConfigEnv()
}
-// CleanupPod cleans up the temporary store
-func (p *PodmanTestIntegration) CleanupPod() {
- // Remove all containers
- session := p.Podman([]string{"pod", "rm", "-fa"})
- session.Wait(90)
- // Nuke tempdir
- if err := os.RemoveAll(p.TempDir); err != nil {
- fmt.Printf("%q\n", err)
- }
-}
-
// CleanupVolume cleans up the temporary store
func (p *PodmanTestIntegration) CleanupVolume() {
// Remove all containers
@@ -494,7 +485,7 @@ func (p *PodmanTestIntegration) PullImage(image string) error {
// container and returns json
func (s *PodmanSessionIntegration) InspectContainerToJSON() []define.InspectContainerData {
var i []define.InspectContainerData
- err := json.Unmarshal(s.Out.Contents(), &i)
+ err := jsoniter.Unmarshal(s.Out.Contents(), &i)
Expect(err).To(BeNil())
return i
}
@@ -502,7 +493,7 @@ func (s *PodmanSessionIntegration) InspectContainerToJSON() []define.InspectCont
// InspectPodToJSON takes the sessions output from a pod inspect and returns json
func (s *PodmanSessionIntegration) InspectPodToJSON() define.InspectPodData {
var i define.InspectPodData
- err := json.Unmarshal(s.Out.Contents(), &i)
+ err := jsoniter.Unmarshal(s.Out.Contents(), &i)
Expect(err).To(BeNil())
return i
}
@@ -583,3 +574,10 @@ func (p *PodmanTestIntegration) CreateSeccompJson(in []byte) (string, error) {
}
return jsonFile, nil
}
+
+func SkipIfNotFedora() {
+ info := GetHostDistributionInfo()
+ if info.Distribution != "fedora" {
+ ginkgo.Skip("Test can only run on Fedora")
+ }
+}