github.com/hanks177/podman/v4@v4.1.3-0.20220613032544-16d90015bc83/pkg/machine/e2e/basic_test.go (about)

     1  package e2e
     2  
     3  import (
     4  	. "github.com/onsi/ginkgo"
     5  	. "github.com/onsi/gomega"
     6  	. "github.com/onsi/gomega/gexec"
     7  )
     8  
     9  var _ = Describe("run basic podman commands", func() {
    10  	var (
    11  		mb      *machineTestBuilder
    12  		testDir string
    13  	)
    14  
    15  	BeforeEach(func() {
    16  		testDir, mb = setup()
    17  	})
    18  	AfterEach(func() {
    19  		teardown(originalHomeDir, testDir, mb)
    20  	})
    21  
    22  	It("Basic ops", func() {
    23  		name := randomString(12)
    24  		i := new(initMachine)
    25  		session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath).withNow()).run()
    26  		Expect(err).To(BeNil())
    27  		Expect(session).To(Exit(0))
    28  
    29  		bm := basicMachine{}
    30  		imgs, err := mb.setCmd(bm.withPodmanCommand([]string{"images", "-q"})).run()
    31  		Expect(err).To(BeNil())
    32  		Expect(imgs).To(Exit(0))
    33  		Expect(len(imgs.outputToStringSlice())).To(Equal(0))
    34  
    35  		newImgs, err := mb.setCmd(bm.withPodmanCommand([]string{"pull", "quay.io/libpod/alpine_nginx"})).run()
    36  		Expect(err).To(BeNil())
    37  		Expect(newImgs).To(Exit(0))
    38  		Expect(len(newImgs.outputToStringSlice())).To(Equal(1))
    39  
    40  		runAlp, err := mb.setCmd(bm.withPodmanCommand([]string{"run", "quay.io/libpod/alpine_nginx", "cat", "/etc/os-release"})).run()
    41  		Expect(err).To(BeNil())
    42  		Expect(runAlp).To(Exit(0))
    43  		Expect(runAlp.outputToString()).To(ContainSubstring("Alpine Linux"))
    44  
    45  		rmCon, err := mb.setCmd(bm.withPodmanCommand([]string{"rm", "-a"})).run()
    46  		Expect(err).To(BeNil())
    47  		Expect(rmCon).To(Exit(0))
    48  	})
    49  
    50  })