ginkgo tests: apply ginkgolinter fixes

I found the ginkgolinter[1] by accident, this looks for not optimal
matching and suggest how to do it better.

Overall these fixes seem to be all correct and they will give much
better error messages when something fails.
Check out the repo to see what the linter reports.

[1] https://github.com/nunnatsa/ginkgolinter

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2022-11-24 17:59:50 +01:00
parent c7827957a4
commit 2ddf1c5cbd
88 changed files with 1210 additions and 1210 deletions

View File

@ -23,46 +23,46 @@ var _ = Describe("podman machine rm", func() {
i := rmMachine{}
reallyLongName := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
session, err := mb.setName(reallyLongName).setCmd(&i).run()
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())
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(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))
rm := rmMachine{}
_, err = mb.setCmd(rm.withForce()).run()
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())
// Inspecting a non-existent machine should fail
// which means it is gone
_, ec, err := mb.toQemuInspectInfo()
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())
Expect(ec).To(Equal(125))
})
It("Remove running machine", func() {
i := new(initMachine)
session, err := mb.setCmd(i.withImagePath(mb.imagePath).withNow()).run()
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())
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(err).ToNot(HaveOccurred())
Expect(stop).To(Exit(125))
// Removing again with force
stopAgain, err := mb.setCmd(rm.withForce()).run()
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())
Expect(stopAgain).To(Exit(0))
// Inspect to be dead sure
_, ec, err := mb.toQemuInspectInfo()
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())
Expect(ec).To(Equal(125))
})
})