From 833456e079c31111a15fedaa3ccd7f852e89e508 Mon Sep 17 00:00:00 2001 From: Brent Baude Date: Sat, 2 Apr 2022 15:25:19 -0500 Subject: Add podman machine test suite This PR introduces a test suite for podman machine. It can currently be run on developers' local machines and is not part of the official CI testing; however, the expectation is that any work on machine should come with an accompanying test. At present, the test must be run on Linux. It is untested on Darwin. There is no Makefile target for the test. It can be run like `ginkgo -v pkg/machine/test/.`. It should be run as a unprivileged user. Signed-off-by: Brent Baude --- pkg/machine/e2e/basic_test.go | 50 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 pkg/machine/e2e/basic_test.go (limited to 'pkg/machine/e2e/basic_test.go') diff --git a/pkg/machine/e2e/basic_test.go b/pkg/machine/e2e/basic_test.go new file mode 100644 index 000000000..f67fb4c67 --- /dev/null +++ b/pkg/machine/e2e/basic_test.go @@ -0,0 +1,50 @@ +package e2e + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/gexec" +) + +var _ = Describe("run basic podman commands", func() { + var ( + mb *machineTestBuilder + testDir string + ) + + BeforeEach(func() { + testDir, mb = setup() + }) + AfterEach(func() { + teardown(originalHomeDir, testDir, mb) + }) + + It("Basic ops", func() { + name := randomString(12) + i := new(initMachine) + session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath).withNow()).run() + Expect(err).To(BeNil()) + Expect(session).To(Exit(0)) + + bm := basicMachine{} + imgs, err := mb.setCmd(bm.withPodmanCommand([]string{"images", "-q"})).run() + Expect(err).To(BeNil()) + Expect(imgs).To(Exit(0)) + Expect(len(imgs.outputToStringSlice())).To(Equal(0)) + + newImgs, err := mb.setCmd(bm.withPodmanCommand([]string{"pull", "quay.io/libpod/alpine_nginx"})).run() + Expect(err).To(BeNil()) + Expect(newImgs).To(Exit(0)) + Expect(len(newImgs.outputToStringSlice())).To(Equal(1)) + + runAlp, err := mb.setCmd(bm.withPodmanCommand([]string{"run", "quay.io/libpod/alpine_nginx", "cat", "/etc/os-release"})).run() + Expect(err).To(BeNil()) + Expect(runAlp).To(Exit(0)) + Expect(runAlp.outputToString()).To(ContainSubstring("Alpine Linux")) + + rmCon, err := mb.setCmd(bm.withPodmanCommand([]string{"rm", "-a"})).run() + Expect(err).To(BeNil()) + Expect(rmCon).To(Exit(0)) + }) + +}) -- cgit v1.2.3-54-g00ecf