mirror of
				https://github.com/containers/podman.git
				synced 2025-10-31 01:50:50 +08:00 
			
		
		
		
	 83a75d2a3d
			
		
	
	83a75d2a3d
	
	
	
		
			
			As Ed has pointed out, the form of Expect(session).To(Exit(0)) provides much better error messages. Let's make Ed happy. Signed-off-by: Brent Baude <bbaude@redhat.com>
		
			
				
	
	
		
			48 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			48 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
| package e2e
 | |
| 
 | |
| import (
 | |
| 	. "github.com/onsi/ginkgo"
 | |
| 	. "github.com/onsi/gomega"
 | |
| 	. "github.com/onsi/gomega/gexec"
 | |
| )
 | |
| 
 | |
| var _ = Describe("podman machine stop", func() {
 | |
| 	var (
 | |
| 		mb      *machineTestBuilder
 | |
| 		testDir string
 | |
| 	)
 | |
| 
 | |
| 	BeforeEach(func() {
 | |
| 		testDir, mb = setup()
 | |
| 	})
 | |
| 	AfterEach(func() {
 | |
| 		teardown(originalHomeDir, testDir, mb)
 | |
| 	})
 | |
| 
 | |
| 	It("stop bad name", func() {
 | |
| 		i := stopMachine{}
 | |
| 		reallyLongName := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
 | |
| 		session, err := mb.setName(reallyLongName).setCmd(&i).run()
 | |
| 		Expect(err).To(BeNil())
 | |
| 		Expect(session).To(Exit(125))
 | |
| 	})
 | |
| 
 | |
| 	It("Stop running machine", func() {
 | |
| 		i := new(initMachine)
 | |
| 		session, err := mb.setCmd(i.withImagePath(mb.imagePath).withNow()).run()
 | |
| 		Expect(err).To(BeNil())
 | |
| 		Expect(session).To(Exit(0))
 | |
| 
 | |
| 		stop := new(stopMachine)
 | |
| 		// Removing a running machine should fail
 | |
| 		stopSession, err := mb.setCmd(stop).run()
 | |
| 		Expect(err).To(BeNil())
 | |
| 		Expect(stopSession).To(Exit(0))
 | |
| 
 | |
| 		// Stopping it again should not result in an error
 | |
| 		stopAgain, err := mb.setCmd(stop).run()
 | |
| 		Expect(err).To(BeNil())
 | |
| 		Expect(stopAgain).To(Exit((0)))
 | |
| 	})
 | |
| })
 |