diff options
92 files changed, 556 insertions, 272 deletions
@@ -177,7 +177,7 @@ localunit: test/goecho/goecho varlink_generate $(MAKE) -C contrib/cirrus/packer test ginkgo: - ginkgo -v -tags "$(BUILDTAGS)" $(GINKGOTIMEOUT) -cover -flakeAttempts 3 -progress -trace -noColor test/e2e/. + ginkgo -v -tags "$(BUILDTAGS)" $(GINKGOTIMEOUT) -cover -flakeAttempts 3 -progress -trace -noColor -nodes 3 test/e2e/. ginkgo-remote: ginkgo -v -tags "$(BUILDTAGS) remoteclient" $(GINKGOTIMEOUT) -cover -flakeAttempts 3 -progress -trace -noColor test/e2e/. diff --git a/cmd/podman/create.go b/cmd/podman/create.go index fa8b9f57b..8a5d0cf73 100644 --- a/cmd/podman/create.go +++ b/cmd/podman/create.go @@ -893,7 +893,16 @@ func joinOrCreateRootlessUserNamespace(createConfig *cc.CreateConfig, runtime *l } return false, -1, errors.Errorf("dependency container %s is not running", ctr.ID()) } - return rootless.JoinNS(uint(pid), 0) + + data, err := ioutil.ReadFile(ctr.Config().ConmonPidFile) + if err != nil { + return false, -1, errors.Wrapf(err, "cannot read conmon PID file %q", ctr.Config().ConmonPidFile) + } + conmonPid, err := strconv.Atoi(string(data)) + if err != nil { + return false, -1, errors.Wrapf(err, "cannot parse PID %q", data) + } + return rootless.JoinDirectUserAndMountNS(uint(conmonPid)) } } return rootless.BecomeRootInUserNS() diff --git a/cmd/podman/exec.go b/cmd/podman/exec.go index c3bcec2ec..e4cea1f5e 100644 --- a/cmd/podman/exec.go +++ b/cmd/podman/exec.go @@ -106,16 +106,25 @@ func execCmd(c *cliconfig.ExecValues) error { } - pid, err := ctr.PID() - if err != nil { - return err - } - became, ret, err := rootless.JoinNS(uint(pid), c.PreserveFDs) - if err != nil { - return err - } - if became { - os.Exit(ret) + if os.Geteuid() != 0 { + var became bool + var ret int + + data, err := ioutil.ReadFile(ctr.Config().ConmonPidFile) + if err != nil { + return errors.Wrapf(err, "cannot read conmon PID file %q", ctr.Config().ConmonPidFile) + } + conmonPid, err := strconv.Atoi(string(data)) + if err != nil { + return errors.Wrapf(err, "cannot parse PID %q", data) + } + became, ret, err = rootless.JoinDirectUserAndMountNS(uint(conmonPid)) + if err != nil { + return err + } + if became { + os.Exit(ret) + } } // ENVIRONMENT VARIABLES diff --git a/cmd/podman/images.go b/cmd/podman/images.go index 78dc87ad5..f92e5d44d 100644 --- a/cmd/podman/images.go +++ b/cmd/podman/images.go @@ -2,6 +2,7 @@ package main import ( "context" + "fmt" "reflect" "sort" "strings" @@ -128,7 +129,7 @@ func init() { func imagesCmd(c *cliconfig.ImagesValues) error { var ( filterFuncs []imagefilters.ResultFilter - newImage *adapter.ContainerImage + image string ) runtime, err := adapter.GetRuntime(&c.PodmanCommand) @@ -137,23 +138,23 @@ func imagesCmd(c *cliconfig.ImagesValues) error { } defer runtime.Shutdown(false) if len(c.InputArgs) == 1 { - newImage, err = runtime.NewImageFromLocal(c.InputArgs[0]) - if err != nil { - return err - } + image = c.InputArgs[0] } - if len(c.InputArgs) > 1 { return errors.New("'podman images' requires at most 1 argument") } - + if len(c.Filter) > 0 && image != "" { + return errors.New("can not specify an image and a filter") + } ctx := getContext() - if len(c.Filter) > 0 || newImage != nil { - filterFuncs, err = CreateFilterFuncs(ctx, runtime, c.Filter, newImage) - if err != nil { - return err - } + if len(c.Filter) > 0 { + filterFuncs, err = CreateFilterFuncs(ctx, runtime, c.Filter, nil) + } else { + filterFuncs, err = CreateFilterFuncs(ctx, runtime, []string{fmt.Sprintf("reference=%s", image)}, nil) + } + if err != nil { + return err } opts := imagesOptions{ @@ -174,7 +175,7 @@ func imagesCmd(c *cliconfig.ImagesValues) error { var filteredImages []*adapter.ContainerImage //filter the images - if len(c.Filter) > 0 || newImage != nil { + if len(c.Filter) > 0 || len(c.InputArgs) == 1 { filteredImages = imagefilters.FilterImages(images, filterFuncs) } else { filteredImages = images diff --git a/cmd/podman/play_kube.go b/cmd/podman/play_kube.go index 980f3a09c..a9dfee33c 100644 --- a/cmd/podman/play_kube.go +++ b/cmd/podman/play_kube.go @@ -243,15 +243,17 @@ func kubeContainerToCreateConfig(containerYAML v1.Container, runtime *libpod.Run containerConfig.Name = containerYAML.Name containerConfig.Tty = containerYAML.TTY containerConfig.WorkDir = containerYAML.WorkingDir - if containerYAML.SecurityContext.ReadOnlyRootFilesystem != nil { - containerConfig.ReadOnlyRootfs = *containerYAML.SecurityContext.ReadOnlyRootFilesystem - } - if containerYAML.SecurityContext.Privileged != nil { - containerConfig.Privileged = *containerYAML.SecurityContext.Privileged - } + if containerConfig.SecurityOpts != nil { + if containerYAML.SecurityContext.ReadOnlyRootFilesystem != nil { + containerConfig.ReadOnlyRootfs = *containerYAML.SecurityContext.ReadOnlyRootFilesystem + } + if containerYAML.SecurityContext.Privileged != nil { + containerConfig.Privileged = *containerYAML.SecurityContext.Privileged + } - if containerYAML.SecurityContext.AllowPrivilegeEscalation != nil { - containerConfig.NoNewPrivs = !*containerYAML.SecurityContext.AllowPrivilegeEscalation + if containerYAML.SecurityContext.AllowPrivilegeEscalation != nil { + containerConfig.NoNewPrivs = !*containerYAML.SecurityContext.AllowPrivilegeEscalation + } } containerConfig.Command = containerYAML.Command @@ -268,7 +270,9 @@ func kubeContainerToCreateConfig(containerYAML v1.Container, runtime *libpod.Run // disabled in code review per mheon //containerConfig.PidMode = ns.PidMode(namespaces["pid"]) containerConfig.UsernsMode = ns.UsernsMode(namespaces["user"]) - + if len(containerConfig.WorkDir) == 0 { + containerConfig.WorkDir = "/" + } if len(containerYAML.Env) > 0 { envs = make(map[string]string) } diff --git a/cmd/podman/shared/container.go b/cmd/podman/shared/container.go index 81811e0f2..e191e8069 100644 --- a/cmd/podman/shared/container.go +++ b/cmd/podman/shared/container.go @@ -665,6 +665,14 @@ func GenerateRunlabelCommand(runLabel, imageName, name string, opts map[string]s return envmap["OPT2"] case "OPT3": return envmap["OPT3"] + case "PWD": + // I would prefer to use os.getenv but it appears PWD is not in the os env list + d, err := os.Getwd() + if err != nil { + logrus.Error("unable to determine current working directory") + return "" + } + return d } return "" } diff --git a/libpod/runtime.go b/libpod/runtime.go index 482cd9d73..9667abfe6 100644 --- a/libpod/runtime.go +++ b/libpod/runtime.go @@ -971,9 +971,12 @@ func (r *Runtime) refreshRootless() error { // Take advantage of a command that requires a new userns // so that we are running as the root user and able to use refresh() cmd := exec.Command(os.Args[0], "info") - err := cmd.Run() - if err != nil { - return errors.Wrapf(err, "Error running %s info while refreshing state", os.Args[0]) + + if output, err := cmd.CombinedOutput(); err != nil { + if _, ok := err.(*exec.ExitError); !ok { + return errors.Wrapf(err, "Error waiting for info while refreshing state: %s", os.Args[0]) + } + return errors.Wrapf(err, "Error running %s info while refreshing state: %s", os.Args[0], output) } return nil } diff --git a/pkg/rootless/rootless_linux.c b/pkg/rootless/rootless_linux.c index 41acd3475..ff39e9e77 100644 --- a/pkg/rootless/rootless_linux.c +++ b/pkg/rootless/rootless_linux.c @@ -277,6 +277,8 @@ reexec_in_user_namespace (int ready) _exit (EXIT_FAILURE); } close (ready); + if (b != '1') + _exit (EXIT_FAILURE); if (syscall_setresgid (0, 0, 0) < 0) { diff --git a/pkg/rootless/rootless_linux.go b/pkg/rootless/rootless_linux.go index 55fba900e..933cfa2c2 100644 --- a/pkg/rootless/rootless_linux.go +++ b/pkg/rootless/rootless_linux.go @@ -229,6 +229,7 @@ func BecomeRootInUserNS() (bool, int, error) { } defer r.Close() defer w.Close() + defer w.Write([]byte("0")) pidC := C.reexec_in_user_namespace(C.int(r.Fd())) pid := int(pidC) diff --git a/test/README.md b/test/README.md index ef3bfbcf9..5e5a7da61 100644 --- a/test/README.md +++ b/test/README.md @@ -105,3 +105,7 @@ You can run the test with following command: ``` make localsystem ``` + +## Contributing to system tests + +Please see [the TODO list of needed workflows/tests](system/TODO.md). diff --git a/test/e2e/attach_test.go b/test/e2e/attach_test.go index 9c013e459..c728f482d 100644 --- a/test/e2e/attach_test.go +++ b/test/e2e/attach_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -24,14 +23,14 @@ var _ = Describe("Podman attach", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) }) diff --git a/test/e2e/checkpoint_test.go b/test/e2e/checkpoint_test.go index 583432df1..5b549755e 100644 --- a/test/e2e/checkpoint_test.go +++ b/test/e2e/checkpoint_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "net" "os" "os/exec" @@ -27,6 +26,7 @@ var _ = Describe("Podman checkpoint", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() // Check if the runtime implements checkpointing. Currently only // runc's checkpoint/restore implementation is supported. @@ -53,8 +53,8 @@ var _ = Describe("Podman checkpoint", func() { AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman checkpoint bogus container", func() { diff --git a/test/e2e/commit_test.go b/test/e2e/commit_test.go index 6b65d9b75..dff156441 100644 --- a/test/e2e/commit_test.go +++ b/test/e2e/commit_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -24,14 +23,14 @@ var _ = Describe("Podman commit", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) }) diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go index b22ead3fa..ecd6d812f 100644 --- a/test/e2e/common_test.go +++ b/test/e2e/common_test.go @@ -3,12 +3,16 @@ package integration import ( "encoding/json" "fmt" + "io/ioutil" "os" "os/exec" "path/filepath" + "sort" "strings" "testing" + "github.com/containers/storage" + "github.com/containers/libpod/pkg/inspect" . "github.com/containers/libpod/test/utils" "github.com/containers/storage/pkg/reexec" @@ -40,13 +44,32 @@ type PodmanTestIntegration struct { SignaturePolicyPath string CgroupManager string Host HostOS + Timings []string } +var LockTmpDir string + // PodmanSessionIntegration sturct for command line session type PodmanSessionIntegration struct { *PodmanSession } +type testResult struct { + name string + length float64 +} + +type testResultsSorted []testResult + +func (a testResultsSorted) Len() int { return len(a) } +func (a testResultsSorted) Swap(i, j int) { a[i], a[j] = a[j], a[i] } + +type testResultsSortedLength struct{ testResultsSorted } + +func (a testResultsSorted) Less(i, j int) bool { return a[i].length < a[j].length } + +var testResults []testResult + // TestLibpod ginkgo master function func TestLibpod(t *testing.T) { if reexec.Init() { @@ -60,7 +83,7 @@ func TestLibpod(t *testing.T) { RunSpecs(t, "Libpod Suite") } -var _ = BeforeSuite(func() { +var _ = SynchronizedBeforeSuite(func() []byte { //Cache images cwd, _ := os.Getwd() INTEGRATION_ROOT = filepath.Join(cwd, "../../") @@ -72,6 +95,7 @@ var _ = BeforeSuite(func() { os.Exit(1) } } + for _, image := range CACHE_IMAGES { if err := podman.CreateArtifact(image); err != nil { fmt.Printf("%q\n", err) @@ -92,6 +116,68 @@ var _ = BeforeSuite(func() { } f.Close() } + path, err := ioutil.TempDir("", "libpodlock") + if err != nil { + fmt.Println(err) + os.Exit(1) + } + return []byte(path) +}, func(data []byte) { + LockTmpDir = string(data) +}) + +func (p *PodmanTestIntegration) Setup() { + cwd, _ := os.Getwd() + INTEGRATION_ROOT = filepath.Join(cwd, "../../") + p.ArtifactPath = ARTIFACT_DIR +} + +//var _ = BeforeSuite(func() { +// cwd, _ := os.Getwd() +// INTEGRATION_ROOT = filepath.Join(cwd, "../../") +// podman := PodmanTestCreate("/tmp") +// podman.ArtifactPath = ARTIFACT_DIR +// if _, err := os.Stat(ARTIFACT_DIR); os.IsNotExist(err) { +// if err = os.Mkdir(ARTIFACT_DIR, 0777); err != nil { +// fmt.Printf("%q\n", err) +// os.Exit(1) +// } +// } +//}) +// for _, image := range CACHE_IMAGES { +// if err := podman.CreateArtifact(image); err != nil { +// fmt.Printf("%q\n", err) +// os.Exit(1) +// } +// } +// host := GetHostDistributionInfo() +// if host.Distribution == "rhel" && strings.HasPrefix(host.Version, "7") { +// f, err := os.OpenFile("/proc/sys/user/max_user_namespaces", os.O_WRONLY, 0644) +// if err != nil { +// fmt.Println("Unable to enable userspace on RHEL 7") +// os.Exit(1) +// } +// _, err = f.WriteString("15000") +// if err != nil { +// fmt.Println("Unable to enable userspace on RHEL 7") +// os.Exit(1) +// } +// f.Close() +// } +// path, err := ioutil.TempDir("", "libpodlock") +// if err != nil { +// fmt.Println(err) +// os.Exit(1) +// } +// LockTmpDir = path +//}) + +var _ = AfterSuite(func() { + sort.Sort(testResultsSortedLength{testResults}) + fmt.Println("integration timing results") + for _, result := range testResults { + fmt.Printf("%s\t\t%f\n", result.name, result.length) + } }) // PodmanTestCreate creates a PodmanTestIntegration instance for the tests @@ -220,3 +306,19 @@ func (s *PodmanSessionIntegration) InspectImageJSON() []inspect.ImageData { Expect(err).To(BeNil()) return i } + +func processTestResult(f GinkgoTestDescription) { + tr := testResult{length: f.Duration.Seconds(), name: f.TestText} + testResults = append(testResults, tr) +} + +func GetPortLock(port string) storage.Locker { + lockFile := filepath.Join(LockTmpDir, port) + lock, err := storage.GetLockfile(lockFile) + if err != nil { + fmt.Println(err) + os.Exit(1) + } + lock.Lock() + return lock +} diff --git a/test/e2e/cp_test.go b/test/e2e/cp_test.go index e1e760ee0..f89865264 100644 --- a/test/e2e/cp_test.go +++ b/test/e2e/cp_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "io/ioutil" "os" "os/exec" @@ -27,14 +26,15 @@ var _ = Describe("Podman cp", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman cp file", func() { diff --git a/test/e2e/create_staticip_test.go b/test/e2e/create_staticip_test.go index 9bdc30342..a67c1a5a8 100644 --- a/test/e2e/create_staticip_test.go +++ b/test/e2e/create_staticip_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -24,6 +23,7 @@ var _ = Describe("Podman create with --ip flag", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() // Cleanup the CNI networks used by the tests os.RemoveAll("/var/lib/cni/networks/podman") @@ -32,8 +32,8 @@ var _ = Describe("Podman create with --ip flag", func() { AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("Podman create --ip with garbage address", func() { diff --git a/test/e2e/create_test.go b/test/e2e/create_test.go index 12e4f3508..6ed5ad2d8 100644 --- a/test/e2e/create_test.go +++ b/test/e2e/create_test.go @@ -25,14 +25,14 @@ var _ = Describe("Podman create", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) }) diff --git a/test/e2e/diff_test.go b/test/e2e/diff_test.go index 82ced7cfa..fba65823e 100644 --- a/test/e2e/diff_test.go +++ b/test/e2e/diff_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" "sort" @@ -25,14 +24,14 @@ var _ = Describe("Podman diff", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) }) diff --git a/test/e2e/exec_test.go b/test/e2e/exec_test.go index 667a81d07..2a10e52b1 100644 --- a/test/e2e/exec_test.go +++ b/test/e2e/exec_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -24,14 +23,14 @@ var _ = Describe("Podman exec", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) }) diff --git a/test/e2e/exists_test.go b/test/e2e/exists_test.go index c4b5e4968..71c6c1820 100644 --- a/test/e2e/exists_test.go +++ b/test/e2e/exists_test.go @@ -1,7 +1,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -22,14 +21,14 @@ var _ = Describe("Podman image|container exists", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) }) diff --git a/test/e2e/export_test.go b/test/e2e/export_test.go index 114c28a3d..71ddb518a 100644 --- a/test/e2e/export_test.go +++ b/test/e2e/export_test.go @@ -1,7 +1,6 @@ package integration import ( - "fmt" "os" "path/filepath" @@ -23,14 +22,14 @@ var _ = Describe("Podman export", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) }) diff --git a/test/e2e/generate_kube_test.go b/test/e2e/generate_kube_test.go index 94e02dc55..2f0af7e5f 100644 --- a/test/e2e/generate_kube_test.go +++ b/test/e2e/generate_kube_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -25,14 +24,14 @@ var _ = Describe("Podman generate kube", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) }) diff --git a/test/e2e/history_test.go b/test/e2e/history_test.go index 9bec9ad13..9e519dd9c 100644 --- a/test/e2e/history_test.go +++ b/test/e2e/history_test.go @@ -1,7 +1,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -22,14 +21,14 @@ var _ = Describe("Podman history", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) }) diff --git a/test/e2e/images_test.go b/test/e2e/images_test.go index 4cf58e5bf..a253dff63 100644 --- a/test/e2e/images_test.go +++ b/test/e2e/images_test.go @@ -24,14 +24,14 @@ var _ = Describe("Podman images", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) }) It("podman images", func() { @@ -112,6 +112,18 @@ var _ = Describe("Podman images", func() { session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) Expect(len(session.OutputToStringArray())).To(Equal(1)) + + session = podmanTest.Podman([]string{"tag", ALPINE, "foo:a"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + session = podmanTest.Podman([]string{"tag", BB, "foo:b"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + session = podmanTest.Podman([]string{"images", "-q", "foo"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(len(session.OutputToStringArray())).To(Equal(2)) }) It("podman images filter reference", func() { diff --git a/test/e2e/import_test.go b/test/e2e/import_test.go index dc7451f7b..e819d819c 100644 --- a/test/e2e/import_test.go +++ b/test/e2e/import_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" "path/filepath" @@ -25,14 +24,15 @@ var _ = Describe("Podman import", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman import with source and reference", func() { diff --git a/test/e2e/info_test.go b/test/e2e/info_test.go index a50c27dda..046297bc0 100644 --- a/test/e2e/info_test.go +++ b/test/e2e/info_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -24,13 +23,14 @@ var _ = Describe("Podman Info", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman info json output", func() { diff --git a/test/e2e/inspect_test.go b/test/e2e/inspect_test.go index e5c471bf9..ebe610e6a 100644 --- a/test/e2e/inspect_test.go +++ b/test/e2e/inspect_test.go @@ -1,7 +1,6 @@ package integration import ( - "fmt" "os" "strings" @@ -23,14 +22,15 @@ var _ = Describe("Podman inspect", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman inspect alpine image", func() { @@ -57,7 +57,7 @@ var _ = Describe("Podman inspect", func() { result := podmanTest.Podman([]string{"images", "-q", "--no-trunc", ALPINE}) result.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - Expect(strings.Trim(result.OutputToString(), "sha256:")).To(Equal(session.OutputToString())) + Expect(strings.Contains(result.OutputToString(), session.OutputToString())) }) It("podman inspect specified type", func() { diff --git a/test/e2e/kill_test.go b/test/e2e/kill_test.go index cde8729c8..618ca5aa0 100644 --- a/test/e2e/kill_test.go +++ b/test/e2e/kill_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -24,14 +23,14 @@ var _ = Describe("Podman kill", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) }) diff --git a/test/e2e/load_test.go b/test/e2e/load_test.go index 571754347..0e193640e 100644 --- a/test/e2e/load_test.go +++ b/test/e2e/load_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" "path/filepath" @@ -25,14 +24,15 @@ var _ = Describe("Podman load", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman load input flag", func() { @@ -190,7 +190,7 @@ var _ = Describe("Podman load", func() { load.WaitWithDefaultTimeout() Expect(load.ExitCode()).To(Equal(0)) - result := podmanTest.Podman([]string{"images", "-f", "label", "hello:world"}) + result := podmanTest.Podman([]string{"images", "hello:world"}) result.WaitWithDefaultTimeout() Expect(result.LineInOutputContains("docker")).To(Not(BeTrue())) Expect(result.LineInOutputContains("localhost")).To(BeTrue()) @@ -216,7 +216,7 @@ var _ = Describe("Podman load", func() { load.WaitWithDefaultTimeout() Expect(load.ExitCode()).To(Equal(0)) - result := podmanTest.Podman([]string{"images", "-f", "label", "hello:latest"}) + result := podmanTest.Podman([]string{"images", "hello:latest"}) result.WaitWithDefaultTimeout() Expect(result.LineInOutputContains("docker")).To(Not(BeTrue())) Expect(result.LineInOutputContains("localhost")).To(BeTrue()) @@ -241,7 +241,7 @@ var _ = Describe("Podman load", func() { load.WaitWithDefaultTimeout() Expect(load.ExitCode()).To(Equal(0)) - result := podmanTest.Podman([]string{"images", "-f", "label", "load:latest"}) + result := podmanTest.Podman([]string{"images", "load:latest"}) result.WaitWithDefaultTimeout() Expect(result.LineInOutputContains("docker")).To(Not(BeTrue())) Expect(result.LineInOutputContains("localhost")).To(BeTrue()) diff --git a/test/e2e/logs_test.go b/test/e2e/logs_test.go index d3c4fb802..b7d959de9 100644 --- a/test/e2e/logs_test.go +++ b/test/e2e/logs_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -24,14 +23,15 @@ var _ = Describe("Podman logs", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) //sudo bin/podman run -it --rm fedora-minimal bash -c 'for a in `seq 5`; do echo hello; done' diff --git a/test/e2e/mount_test.go b/test/e2e/mount_test.go index bf0442de2..b361e0057 100644 --- a/test/e2e/mount_test.go +++ b/test/e2e/mount_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -24,14 +23,15 @@ var _ = Describe("Podman mount", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman mount", func() { diff --git a/test/e2e/namespace_test.go b/test/e2e/namespace_test.go index a0b6e6187..28d050be3 100644 --- a/test/e2e/namespace_test.go +++ b/test/e2e/namespace_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -24,14 +23,15 @@ var _ = Describe("Podman namespaces", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman namespace test", func() { diff --git a/test/e2e/pause_test.go b/test/e2e/pause_test.go index 7530ca85c..2d4c1d303 100644 --- a/test/e2e/pause_test.go +++ b/test/e2e/pause_test.go @@ -27,14 +27,15 @@ var _ = Describe("Podman pause", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman pause bogus container", func() { diff --git a/test/e2e/pod_create_test.go b/test/e2e/pod_create_test.go index 4717267a1..5ffc0f779 100644 --- a/test/e2e/pod_create_test.go +++ b/test/e2e/pod_create_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -24,14 +23,15 @@ var _ = Describe("Podman pod create", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.CleanupPod() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman create pod", func() { diff --git a/test/e2e/pod_infra_container_test.go b/test/e2e/pod_infra_container_test.go index cb476c7f6..82f35999c 100644 --- a/test/e2e/pod_infra_container_test.go +++ b/test/e2e/pod_infra_container_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" "strconv" @@ -25,6 +24,7 @@ var _ = Describe("Podman pod create", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() podmanTest.RestoreArtifact(infra) }) @@ -32,8 +32,8 @@ var _ = Describe("Podman pod create", func() { AfterEach(func() { podmanTest.CleanupPod() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman create infra container", func() { @@ -221,8 +221,7 @@ var _ = Describe("Podman pod create", func() { session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - podmanTest.RestoreArtifact(fedoraMinimal) - session = podmanTest.Podman([]string{"run", "--pod", podID, "--network", "bridge", fedoraMinimal, "curl", "localhost"}) + session = podmanTest.Podman([]string{"run", "--pod", podID, "--network", "bridge", nginx, "curl", "localhost"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Not(Equal(0))) }) diff --git a/test/e2e/pod_inspect_test.go b/test/e2e/pod_inspect_test.go index 457acb373..671d203a6 100644 --- a/test/e2e/pod_inspect_test.go +++ b/test/e2e/pod_inspect_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -24,14 +23,15 @@ var _ = Describe("Podman pod inspect", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.CleanupPod() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman inspect bogus pod", func() { diff --git a/test/e2e/pod_kill_test.go b/test/e2e/pod_kill_test.go index 419a3a777..c1f7503e3 100644 --- a/test/e2e/pod_kill_test.go +++ b/test/e2e/pod_kill_test.go @@ -24,14 +24,15 @@ var _ = Describe("Podman pod kill", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.CleanupPod() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman pod kill bogus", func() { diff --git a/test/e2e/pod_pause_test.go b/test/e2e/pod_pause_test.go index a5192f84b..62dc919b6 100644 --- a/test/e2e/pod_pause_test.go +++ b/test/e2e/pod_pause_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -26,14 +25,15 @@ var _ = Describe("Podman pod pause", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.CleanupPod() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman pod pause bogus pod", func() { diff --git a/test/e2e/pod_pod_namespaces.go b/test/e2e/pod_pod_namespaces.go index 9815e37ef..9d6321c0e 100644 --- a/test/e2e/pod_pod_namespaces.go +++ b/test/e2e/pod_pod_namespaces.go @@ -24,6 +24,7 @@ var _ = Describe("Podman pod create", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() podmanTest.RestoreArtifact(infra) }) @@ -31,8 +32,8 @@ var _ = Describe("Podman pod create", func() { AfterEach(func() { podmanTest.CleanupPod() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman pod container share Namespaces", func() { diff --git a/test/e2e/pod_ps_test.go b/test/e2e/pod_ps_test.go index 3b7198861..2fa26d7ad 100644 --- a/test/e2e/pod_ps_test.go +++ b/test/e2e/pod_ps_test.go @@ -25,14 +25,15 @@ var _ = Describe("Podman ps", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.CleanupPod() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman pod ps no pods", func() { diff --git a/test/e2e/pod_restart_test.go b/test/e2e/pod_restart_test.go index e8acfd2ec..ffb6cb94c 100644 --- a/test/e2e/pod_restart_test.go +++ b/test/e2e/pod_restart_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -24,14 +23,15 @@ var _ = Describe("Podman pod restart", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.CleanupPod() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman pod restart bogus pod", func() { diff --git a/test/e2e/pod_rm_test.go b/test/e2e/pod_rm_test.go index f63d2c8aa..f9d7abe8f 100644 --- a/test/e2e/pod_rm_test.go +++ b/test/e2e/pod_rm_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -24,14 +23,15 @@ var _ = Describe("Podman pod rm", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.CleanupPod() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman pod rm empty pod", func() { diff --git a/test/e2e/pod_start_test.go b/test/e2e/pod_start_test.go index ce693012d..de52af2a0 100644 --- a/test/e2e/pod_start_test.go +++ b/test/e2e/pod_start_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -24,14 +23,15 @@ var _ = Describe("Podman pod start", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.CleanupPod() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman pod start bogus pod", func() { diff --git a/test/e2e/pod_stats_test.go b/test/e2e/pod_stats_test.go index e330c3a39..ceabb9dc1 100644 --- a/test/e2e/pod_stats_test.go +++ b/test/e2e/pod_stats_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -24,14 +23,15 @@ var _ = Describe("Podman pod stats", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.CleanupPod() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman stats should run with no pods", func() { session := podmanTest.Podman([]string{"pod", "stats", "--no-stream"}) diff --git a/test/e2e/pod_stop_test.go b/test/e2e/pod_stop_test.go index 38f118964..fa285fa80 100644 --- a/test/e2e/pod_stop_test.go +++ b/test/e2e/pod_stop_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -24,14 +23,15 @@ var _ = Describe("Podman pod stop", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.CleanupPod() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman pod stop bogus pod", func() { diff --git a/test/e2e/pod_top_test.go b/test/e2e/pod_top_test.go index 507d723b4..964ee075f 100644 --- a/test/e2e/pod_top_test.go +++ b/test/e2e/pod_top_test.go @@ -5,6 +5,7 @@ package integration import ( "fmt" "os" + "time" . "github.com/containers/libpod/test/utils" . "github.com/onsi/ginkgo" @@ -24,14 +25,15 @@ var _ = Describe("Podman top", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.CleanupPod() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman pod top without pod name or id", func() { @@ -127,6 +129,13 @@ var _ = Describe("Podman top", func() { session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) + for i := 0; i < 10; i++ { + fmt.Println("Waiting for containers to be running .... ") + if podmanTest.NumberOfContainersRunning() == 2 { + break + } + time.Sleep(1 * time.Second) + } result := podmanTest.Podman([]string{"pod", "top", podid}) result.WaitWithDefaultTimeout() Expect(result.ExitCode()).To(Equal(0)) diff --git a/test/e2e/port_test.go b/test/e2e/port_test.go index 6ddc5d34f..7cf3e16bf 100644 --- a/test/e2e/port_test.go +++ b/test/e2e/port_test.go @@ -25,14 +25,15 @@ var _ = Describe("Podman port", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman port all and latest", func() { diff --git a/test/e2e/prune_test.go b/test/e2e/prune_test.go index 74cdc126f..869ca3289 100644 --- a/test/e2e/prune_test.go +++ b/test/e2e/prune_test.go @@ -1,7 +1,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -28,14 +27,15 @@ var _ = Describe("Podman rm", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman container prune containers", func() { diff --git a/test/e2e/ps_test.go b/test/e2e/ps_test.go index a31fc3f09..58697acde 100644 --- a/test/e2e/ps_test.go +++ b/test/e2e/ps_test.go @@ -28,14 +28,15 @@ var _ = Describe("Podman ps", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman ps no containers", func() { @@ -271,8 +272,7 @@ var _ = Describe("Podman ps", func() { session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - podmanTest.RestoreArtifact(fedoraMinimal) - session = podmanTest.Podman([]string{"run", "-d", fedoraMinimal, "pwd"}) + session = podmanTest.Podman([]string{"run", "-d", ALPINE, "pwd"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) diff --git a/test/e2e/pull_test.go b/test/e2e/pull_test.go index d9b9c7213..de6d4ea09 100644 --- a/test/e2e/pull_test.go +++ b/test/e2e/pull_test.go @@ -27,14 +27,15 @@ var _ = Describe("Podman pull", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman pull from docker with tag", func() { diff --git a/test/e2e/push_test.go b/test/e2e/push_test.go index fee117783..89df62d42 100644 --- a/test/e2e/push_test.go +++ b/test/e2e/push_test.go @@ -26,14 +26,15 @@ var _ = Describe("Podman push", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman push to containers/storage", func() { @@ -62,6 +63,8 @@ var _ = Describe("Podman push", func() { if podmanTest.Host.Arch == "ppc64le" { Skip("No registry image for ppc64le") } + lock := GetPortLock("5000") + defer lock.Unlock() podmanTest.RestoreArtifact(registry) session := podmanTest.Podman([]string{"run", "-d", "--name", "registry", "-p", "5000:5000", registry, "/entrypoint.sh", "/etc/docker/registry/config.yml"}) session.WaitWithDefaultTimeout() @@ -100,6 +103,8 @@ var _ = Describe("Podman push", func() { }() } } + lock := GetPortLock("5000") + defer lock.Unlock() podmanTest.RestoreArtifact(registry) session := podmanTest.Podman([]string{"run", "--entrypoint", "htpasswd", registry, "-Bbn", "podmantest", "test"}) session.WaitWithDefaultTimeout() diff --git a/test/e2e/refresh_test.go b/test/e2e/refresh_test.go index de331bf88..56c1d255e 100644 --- a/test/e2e/refresh_test.go +++ b/test/e2e/refresh_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" "time" @@ -25,14 +24,15 @@ var _ = Describe("Podman refresh", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tmpdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) Specify("Refresh with no containers succeeds", func() { diff --git a/test/e2e/restart_test.go b/test/e2e/restart_test.go index a101219d4..1daf63a0e 100644 --- a/test/e2e/restart_test.go +++ b/test/e2e/restart_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" "time" @@ -25,14 +24,15 @@ var _ = Describe("Podman restart", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("Podman restart bogus container", func() { diff --git a/test/e2e/rm_test.go b/test/e2e/rm_test.go index db08dda8b..1f67780da 100644 --- a/test/e2e/rm_test.go +++ b/test/e2e/rm_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -24,14 +23,15 @@ var _ = Describe("Podman rm", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman rm stopped container", func() { diff --git a/test/e2e/rmi_test.go b/test/e2e/rmi_test.go index 26cc925ef..78d175637 100644 --- a/test/e2e/rmi_test.go +++ b/test/e2e/rmi_test.go @@ -22,14 +22,14 @@ var _ = Describe("Podman rmi", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) }) diff --git a/test/e2e/rootless_test.go b/test/e2e/rootless_test.go index aa8ed6faa..908c459da 100644 --- a/test/e2e/rootless_test.go +++ b/test/e2e/rootless_test.go @@ -45,14 +45,15 @@ var _ = Describe("Podman rootless", func() { podmanTest = PodmanTestCreate(tempdir) podmanTest.CgroupManager = "cgroupfs" podmanTest.StorageOptions = ROOTLESS_STORAGE_OPTIONS + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman rootless help|version", func() { diff --git a/test/e2e/run_cgroup_parent_test.go b/test/e2e/run_cgroup_parent_test.go index efc9a7009..a6955591f 100644 --- a/test/e2e/run_cgroup_parent_test.go +++ b/test/e2e/run_cgroup_parent_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -24,14 +23,15 @@ var _ = Describe("Podman run with --cgroup-parent", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreArtifact(fedoraMinimal) }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) Specify("valid --cgroup-parent using cgroupfs", func() { diff --git a/test/e2e/run_cleanup_test.go b/test/e2e/run_cleanup_test.go index 1f2a4085d..b20e37794 100644 --- a/test/e2e/run_cleanup_test.go +++ b/test/e2e/run_cleanup_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -24,14 +23,15 @@ var _ = Describe("Podman run exit", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman run -d mount cleanup test", func() { diff --git a/test/e2e/run_cpu_test.go b/test/e2e/run_cpu_test.go index f74d3ed84..a2dd5b9b8 100644 --- a/test/e2e/run_cpu_test.go +++ b/test/e2e/run_cpu_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -24,14 +23,15 @@ var _ = Describe("Podman run cpu", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman run cpu-period", func() { diff --git a/test/e2e/run_device_test.go b/test/e2e/run_device_test.go index 8734bb71c..5f59fbe37 100644 --- a/test/e2e/run_device_test.go +++ b/test/e2e/run_device_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -24,14 +23,15 @@ var _ = Describe("Podman run device", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman run bad device test", func() { diff --git a/test/e2e/run_dns_test.go b/test/e2e/run_dns_test.go index 6c649cdbc..875c90d73 100644 --- a/test/e2e/run_dns_test.go +++ b/test/e2e/run_dns_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -24,14 +23,15 @@ var _ = Describe("Podman run dns", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman run add search domain", func() { diff --git a/test/e2e/run_entrypoint_test.go b/test/e2e/run_entrypoint_test.go index a33e16b63..ee9fd1263 100644 --- a/test/e2e/run_entrypoint_test.go +++ b/test/e2e/run_entrypoint_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -24,14 +23,15 @@ var _ = Describe("Podman run entrypoint", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreArtifact(ALPINE) }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman run no command, entrypoint, or cmd", func() { diff --git a/test/e2e/run_exit_test.go b/test/e2e/run_exit_test.go index 03072f598..da4cf7ee7 100644 --- a/test/e2e/run_exit_test.go +++ b/test/e2e/run_exit_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -24,14 +23,15 @@ var _ = Describe("Podman run exit", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman run exit 125", func() { @@ -59,8 +59,7 @@ var _ = Describe("Podman run exit", func() { }) It("podman run exit 50", func() { - podmanTest.RestoreArtifact(fedoraMinimal) - result := podmanTest.Podman([]string{"run", "registry.fedoraproject.org/fedora-minimal", "bash", "-c", "exit 50"}) + result := podmanTest.Podman([]string{"run", ALPINE, "sh", "-c", "exit 50"}) result.WaitWithDefaultTimeout() Expect(result.ExitCode()).To(Equal(50)) }) diff --git a/test/e2e/run_memory_test.go b/test/e2e/run_memory_test.go index e9262d4f0..790cdf743 100644 --- a/test/e2e/run_memory_test.go +++ b/test/e2e/run_memory_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -24,14 +23,15 @@ var _ = Describe("Podman run memory", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman run memory test", func() { diff --git a/test/e2e/run_networking_test.go b/test/e2e/run_networking_test.go index c89a4f487..80378dc7b 100644 --- a/test/e2e/run_networking_test.go +++ b/test/e2e/run_networking_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -25,14 +24,15 @@ var _ = Describe("Podman run networking", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman run network connection with default bridge", func() { diff --git a/test/e2e/run_ns_test.go b/test/e2e/run_ns_test.go index 3d95c3a0b..51f921bce 100644 --- a/test/e2e/run_ns_test.go +++ b/test/e2e/run_ns_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" "strings" @@ -25,14 +24,15 @@ var _ = Describe("Podman run ns", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreArtifact(fedoraMinimal) }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman run pidns test", func() { diff --git a/test/e2e/run_passwd_test.go b/test/e2e/run_passwd_test.go index fcb81fb77..becbc5bfa 100644 --- a/test/e2e/run_passwd_test.go +++ b/test/e2e/run_passwd_test.go @@ -5,7 +5,6 @@ package integration import ( "os" - "fmt" . "github.com/containers/libpod/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -24,14 +23,15 @@ var _ = Describe("Podman run passwd", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman run no user specified ", func() { diff --git a/test/e2e/run_privileged_test.go b/test/e2e/run_privileged_test.go index ee6e8e950..a4500e421 100644 --- a/test/e2e/run_privileged_test.go +++ b/test/e2e/run_privileged_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" "strings" @@ -25,14 +24,15 @@ var _ = Describe("Podman privileged container tests", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman privileged make sure sys is mounted rw", func() { diff --git a/test/e2e/run_restart_test.go b/test/e2e/run_restart_test.go index 2659d2b11..9976b45e8 100644 --- a/test/e2e/run_restart_test.go +++ b/test/e2e/run_restart_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -24,14 +23,15 @@ var _ = Describe("Podman run restart containers", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("Podman start after successful run", func() { diff --git a/test/e2e/run_selinux_test.go b/test/e2e/run_selinux_test.go index 57e488abc..282806562 100644 --- a/test/e2e/run_selinux_test.go +++ b/test/e2e/run_selinux_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -25,6 +24,7 @@ var _ = Describe("Podman run", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() if !selinux.GetEnabled() { Skip("SELinux not enabled") @@ -34,8 +34,8 @@ var _ = Describe("Podman run", func() { AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman run selinux", func() { diff --git a/test/e2e/run_signal_test.go b/test/e2e/run_signal_test.go index 51c14602e..e482adb84 100644 --- a/test/e2e/run_signal_test.go +++ b/test/e2e/run_signal_test.go @@ -32,14 +32,15 @@ var _ = Describe("Podman run with --sig-proxy", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tmpdir) + podmanTest.Setup() podmanTest.RestoreArtifact(fedoraMinimal) }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) Specify("signals are forwarded to container using sig-proxy", func() { diff --git a/test/e2e/run_staticip_test.go b/test/e2e/run_staticip_test.go index bf50e5eb7..464f9513a 100644 --- a/test/e2e/run_staticip_test.go +++ b/test/e2e/run_staticip_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -24,6 +23,7 @@ var _ = Describe("Podman run with --ip flag", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() // Cleanup the CNI networks used by the tests os.RemoveAll("/var/lib/cni/networks/podman") @@ -32,8 +32,8 @@ var _ = Describe("Podman run with --ip flag", func() { AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("Podman run --ip with garbage address", func() { diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go index 4ba32a94a..9d89905c2 100644 --- a/test/e2e/run_test.go +++ b/test/e2e/run_test.go @@ -29,14 +29,15 @@ var _ = Describe("Podman run", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman run a container based on local image", func() { diff --git a/test/e2e/run_userns_test.go b/test/e2e/run_userns_test.go index 254897e70..b67b694b0 100644 --- a/test/e2e/run_userns_test.go +++ b/test/e2e/run_userns_test.go @@ -5,7 +5,6 @@ package integration import ( "os" - "fmt" . "github.com/containers/libpod/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -24,14 +23,15 @@ var _ = Describe("Podman UserNS support", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman uidmapping and gidmapping", func() { diff --git a/test/e2e/runlabel_test.go b/test/e2e/runlabel_test.go index 49b9e13d8..b1d057bfd 100644 --- a/test/e2e/runlabel_test.go +++ b/test/e2e/runlabel_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -32,14 +31,14 @@ var _ = Describe("podman container runlabel", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) }) diff --git a/test/e2e/save_test.go b/test/e2e/save_test.go index 9f64e49a7..c3edc7c7e 100644 --- a/test/e2e/save_test.go +++ b/test/e2e/save_test.go @@ -1,7 +1,6 @@ package integration import ( - "fmt" "os" "path/filepath" @@ -23,14 +22,15 @@ var _ = Describe("Podman save", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman save output flag", func() { diff --git a/test/e2e/search_test.go b/test/e2e/search_test.go index 167f8fa25..589389b3b 100644 --- a/test/e2e/search_test.go +++ b/test/e2e/search_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" "strconv" @@ -44,14 +43,15 @@ var _ = Describe("Podman search", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman search", func() { @@ -134,6 +134,9 @@ var _ = Describe("Podman search", func() { if podmanTest.Host.Arch == "ppc64le" { Skip("No registry image for ppc64le") } + lock := GetPortLock("5000") + defer lock.Unlock() + podmanTest.RestoreArtifact(registry) fakereg := podmanTest.Podman([]string{"run", "-d", "--name", "registry", "-p", "5000:5000", registry, "/entrypoint.sh", "/etc/docker/registry/config.yml"}) fakereg.WaitWithDefaultTimeout() @@ -157,6 +160,8 @@ var _ = Describe("Podman search", func() { if podmanTest.Host.Arch == "ppc64le" { Skip("No registry image for ppc64le") } + lock := GetPortLock("5000") + defer lock.Unlock() podmanTest.RestoreArtifact(registry) registry := podmanTest.Podman([]string{"run", "-d", "--name", "registry3", "-p", "5000:5000", registry, "/entrypoint.sh", "/etc/docker/registry/config.yml"}) registry.WaitWithDefaultTimeout() @@ -180,6 +185,8 @@ var _ = Describe("Podman search", func() { if podmanTest.Host.Arch == "ppc64le" { Skip("No registry image for ppc64le") } + lock := GetPortLock("5000") + defer lock.Unlock() podmanTest.RestoreArtifact(registry) registry := podmanTest.Podman([]string{"run", "-d", "--name", "registry4", "-p", "5000:5000", registry, "/entrypoint.sh", "/etc/docker/registry/config.yml"}) registry.WaitWithDefaultTimeout() @@ -212,6 +219,8 @@ var _ = Describe("Podman search", func() { if podmanTest.Host.Arch == "ppc64le" { Skip("No registry image for ppc64le") } + lock := GetPortLock("5000") + defer lock.Unlock() podmanTest.RestoreArtifact(registry) registry := podmanTest.Podman([]string{"run", "-d", "-p", "5000:5000", "--name", "registry5", registry}) registry.WaitWithDefaultTimeout() @@ -243,6 +252,8 @@ var _ = Describe("Podman search", func() { if podmanTest.Host.Arch == "ppc64le" { Skip("No registry image for ppc64le") } + lock := GetPortLock("5000") + defer lock.Unlock() podmanTest.RestoreArtifact(registry) registry := podmanTest.Podman([]string{"run", "-d", "-p", "5000:5000", "--name", "registry6", registry}) registry.WaitWithDefaultTimeout() @@ -274,6 +285,8 @@ var _ = Describe("Podman search", func() { if podmanTest.Host.Arch == "ppc64le" { Skip("No registry image for ppc64le") } + lock := GetPortLock("5000") + defer lock.Unlock() podmanTest.RestoreArtifact(registry) registryLocal := podmanTest.Podman([]string{"run", "-d", "-p", "5000:5000", "--name", "registry7", registry}) registryLocal.WaitWithDefaultTimeout() diff --git a/test/e2e/start_test.go b/test/e2e/start_test.go index 51fece3f1..28f1c2393 100644 --- a/test/e2e/start_test.go +++ b/test/e2e/start_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -24,14 +23,15 @@ var _ = Describe("Podman start", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman start bogus container", func() { diff --git a/test/e2e/stats_test.go b/test/e2e/stats_test.go index e7b0b5f6e..e95265617 100644 --- a/test/e2e/stats_test.go +++ b/test/e2e/stats_test.go @@ -24,14 +24,15 @@ var _ = Describe("Podman stats", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman stats with bogus container", func() { diff --git a/test/e2e/stop_test.go b/test/e2e/stop_test.go index cd0d804ee..97c9287b9 100644 --- a/test/e2e/stop_test.go +++ b/test/e2e/stop_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -24,14 +23,15 @@ var _ = Describe("Podman stop", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman stop bogus container", func() { diff --git a/test/e2e/systemd_test.go b/test/e2e/systemd_test.go index 252361288..558635d70 100644 --- a/test/e2e/systemd_test.go +++ b/test/e2e/systemd_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "io/ioutil" "os" @@ -26,6 +25,7 @@ var _ = Describe("Podman systemd", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() systemd_unit_file = `[Unit] Description=redis container @@ -42,8 +42,8 @@ WantedBy=multi-user.target AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman start container by systemd", func() { diff --git a/test/e2e/tag_test.go b/test/e2e/tag_test.go index 9f67eaf80..ff0ac31c4 100644 --- a/test/e2e/tag_test.go +++ b/test/e2e/tag_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -24,14 +23,15 @@ var _ = Describe("Podman tag", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman tag shortname:latest", func() { diff --git a/test/e2e/top_test.go b/test/e2e/top_test.go index 156c37035..2d3a5629c 100644 --- a/test/e2e/top_test.go +++ b/test/e2e/top_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -24,14 +23,15 @@ var _ = Describe("Podman top", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman top without container name or id", func() { diff --git a/test/e2e/trust_test.go b/test/e2e/trust_test.go index 0d36266f6..493c4a7d5 100644 --- a/test/e2e/trust_test.go +++ b/test/e2e/trust_test.go @@ -4,7 +4,6 @@ package integration import ( "encoding/json" - "fmt" "io/ioutil" "os" "path/filepath" @@ -27,14 +26,15 @@ var _ = Describe("Podman trust", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman image trust show", func() { diff --git a/test/e2e/version_test.go b/test/e2e/version_test.go index 68a462bdb..b66291734 100644 --- a/test/e2e/version_test.go +++ b/test/e2e/version_test.go @@ -1,7 +1,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -27,8 +26,8 @@ var _ = Describe("Podman version", func() { AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman version", func() { diff --git a/test/e2e/volume_create_test.go b/test/e2e/volume_create_test.go index 50ee63f2a..dccecd457 100644 --- a/test/e2e/volume_create_test.go +++ b/test/e2e/volume_create_test.go @@ -1,7 +1,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -22,14 +21,15 @@ var _ = Describe("Podman volume create", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.CleanupVolume() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman create volume", func() { diff --git a/test/e2e/volume_inspect_test.go b/test/e2e/volume_inspect_test.go index d0d5a601e..e7f20ce7b 100644 --- a/test/e2e/volume_inspect_test.go +++ b/test/e2e/volume_inspect_test.go @@ -1,7 +1,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -22,14 +21,15 @@ var _ = Describe("Podman volume inspect", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.CleanupVolume() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman inspect volume", func() { diff --git a/test/e2e/volume_ls_test.go b/test/e2e/volume_ls_test.go index 119d29d9b..1f0177def 100644 --- a/test/e2e/volume_ls_test.go +++ b/test/e2e/volume_ls_test.go @@ -1,7 +1,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -22,14 +21,15 @@ var _ = Describe("Podman volume ls", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.CleanupVolume() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman ls volume", func() { diff --git a/test/e2e/volume_prune_test.go b/test/e2e/volume_prune_test.go index 802f3fc4a..55a95c8c9 100644 --- a/test/e2e/volume_prune_test.go +++ b/test/e2e/volume_prune_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -24,14 +23,15 @@ var _ = Describe("Podman volume prune", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.CleanupVolume() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman prune volume", func() { diff --git a/test/e2e/volume_rm_test.go b/test/e2e/volume_rm_test.go index 6a1e7d0e8..888474670 100644 --- a/test/e2e/volume_rm_test.go +++ b/test/e2e/volume_rm_test.go @@ -1,7 +1,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -22,14 +21,15 @@ var _ = Describe("Podman volume rm", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.CleanupVolume() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman rm volume", func() { diff --git a/test/e2e/wait_test.go b/test/e2e/wait_test.go index 69e64774c..5bf0331e5 100644 --- a/test/e2e/wait_test.go +++ b/test/e2e/wait_test.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/libpod/test/utils" @@ -24,14 +23,15 @@ var _ = Describe("Podman wait", func() { os.Exit(1) } podmanTest = PodmanTestCreate(tempdir) + podmanTest.Setup() podmanTest.RestoreAllArtifacts() }) AfterEach(func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) + processTestResult(f) + }) It("podman wait on bogus container", func() { diff --git a/test/system/TODO.md b/test/system/TODO.md new file mode 100644 index 000000000..f6110d2e9 --- /dev/null +++ b/test/system/TODO.md @@ -0,0 +1,105 @@ +![PODMAN logo](../../logo/podman-logo-source.svg) + +# Overview + +System tests exercise Podman in the context of a complete, composed environment from +distribution packages. It should match as closely as possible to how an end-user +would experience a fresh-install. Dependencies on external configuration and resources +must be kept minimal, and the tests must be generic and vendor-neutral. + +The system-tests must execute cleanly on all tested platforms. They may optionally +be executed during continuous-integration testing of code-changes, after all other +testing completes successfully. For a list of tested platforms, please see [the +CI configuration file.](../../.cirrus.yml) + + +# Execution + +When working from a clone of [the libpod repository](https://github.com/containers/libpod), +the main entry-point for humans and automation is `make localsystem`. When operating +from a packaged version of the system-tests, the entry-point may vary as appropriate. +Running the packaged system-tests assumes the version of Podman matches the test +version, and all standard dependencies are installed. + + +# Test Design and overview + +System-tests should be high-level and user work-flow oriented. For example, consider +how multiple Podman invocations would be used together by an end-user. The set of +related commands should be considered a single test. If one or more intermediate +commands fail, the test could still pass if the end-result is still achieved. + + +# *TODO*: List of needed System-tests + +***Note***: Common operations (like `rm` and `rmi` for cleanup/reset) +have been omitted as they are verified by repeated implied use. + +- [ ] pull, build, run, attach, commit, diff, inspect + + - Pull existing image from registry + - Build new image FROM explicitly pulled image + - Run built container in detached mode + - Attach to running container, execute command to modify storage. + - Commit running container to new image w/ changed ENV VAR + - Verify attach + commit using diff + - verify changed ENV VAR with inspect + +- [ ] Implied pull, create, start, exec, log, stop, wait, rm + + - Create non-existing local image + - start stopped container + - exec simple command in running container + - verify exec result with log + - wait on running container + - stop running container with 2 second timeout + - verify wait in 4 seconds or less + - verify stopped by rm **without** --force + +- [ ] Implied pull, build, export, modify, import, tag, run, kill + + - Build from Dockerfile FROM non-existing local image + - Export built container as tarball + - Modify tarball contents + - Import tarball + - Tag imported image + - Run imported image to confirm tarball modification, block on non-special signal + - Kill can send non-TERM/KILL signal to container to exit + - Confirm exit within timeout + +- [ ] Container runlabel, exists, checkpoint, exists, restore, stop, prune + + - Using pre-existing remote image, start it with 'podman container runlabel --pull' + - Run a named container that exits immediatly + - Confirm 'container exists' zero exit (both containers) + - Checkpoint the running container + - Confirm 'container exists' non-zero exit (runlabel container) + - Confirm 'container exists' zero exit (named container) + - Run 'container restore' + - Confirm 'container exists' zero exit (both containers) + - Stop container + - Run 'container prune' + - Confirm `podman ps -a` lists no containers + + +# TODO: List of commands to be combined into additional workflows above. + +- podman-remote (workflow TBD) +- history +- image +- load +- mount +- pause +- pod +- port +- login, push, & logout (difficult, save for last) +- restart +- save +- search +- stats +- top +- umount, unmount +- unpause +- volume +- `--namespace` +- `--storage-driver` |