mirror of
https://github.com/containers/podman.git
synced 2025-11-03 15:56:51 +08:00
Produce better test error messages
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>
This commit is contained in:
@ -3,6 +3,7 @@ package e2e
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
. "github.com/onsi/gomega/gexec"
|
||||
)
|
||||
|
||||
var _ = Describe("podman machine rm", func() {
|
||||
@ -23,14 +24,14 @@ var _ = Describe("podman machine rm", func() {
|
||||
reallyLongName := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
session, err := mb.setName(reallyLongName).setCmd(&i).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(session.ExitCode()).To(Equal(125))
|
||||
Expect(session).To(Exit(125))
|
||||
})
|
||||
|
||||
It("Remove machine", func() {
|
||||
i := new(initMachine)
|
||||
session, err := mb.setCmd(i.withImagePath(mb.imagePath)).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
Expect(session).To(Exit(0))
|
||||
rm := rmMachine{}
|
||||
_, err = mb.setCmd(rm.withForce()).run()
|
||||
Expect(err).To(BeNil())
|
||||
@ -46,18 +47,18 @@ var _ = Describe("podman machine rm", func() {
|
||||
i := new(initMachine)
|
||||
session, err := mb.setCmd(i.withImagePath(mb.imagePath).withNow()).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
Expect(session).To(Exit(0))
|
||||
rm := new(rmMachine)
|
||||
|
||||
// Removing a running machine should fail
|
||||
stop, err := mb.setCmd(rm).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(stop.ExitCode()).To(Equal(125))
|
||||
Expect(stop).To(Exit(125))
|
||||
|
||||
// Removing again with force
|
||||
stopAgain, err := mb.setCmd(rm.withForce()).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(stopAgain.ExitCode()).To(BeZero())
|
||||
Expect(stopAgain).To(Exit(0))
|
||||
|
||||
// Inspect to be dead sure
|
||||
_, ec, err := mb.toQemuInspectInfo()
|
||||
|
||||
Reference in New Issue
Block a user