Modify machine "Remove machine" test

Modifies the "Remove machine" test to verify the system connections are
handled properly on removal.

Signed-off-by: Jake Correnti <jakecorrenti+github@proton.me>
This commit is contained in:
Jake Correnti
2024-09-12 15:08:25 -04:00
parent 24deec835c
commit e9b8564690

View File

@ -43,6 +43,33 @@ var _ = Describe("podman machine rm", func() {
Expect(err).ToNot(HaveOccurred())
Expect(removeSession2).To(Exit(125))
Expect(removeSession2.errorToString()).To(ContainSubstring(fmt.Sprintf("%s: VM does not exist", name)))
// Ensure that the system connections have the right rootfulness
name = randomString()
i = new(initMachine)
session, err = mb.setName(name).setCmd(i.withImage(mb.imagePath)).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))
name2 := randomString()
i = new(initMachine)
session, err = mb.setName(name2).setCmd(i.withImage(mb.imagePath).withRootful(true)).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))
bm := basicMachine{}
sysConnOutput, err := mb.setCmd(bm.withPodmanCommand([]string{"system", "connection", "list", "--format", "{{.Name}}--{{.Default}}"})).run()
Expect(err).ToNot(HaveOccurred())
Expect(sysConnOutput.outputToString()).To(ContainSubstring(name + "--true"))
rm = rmMachine{}
removeSession, err = mb.setName(name).setCmd(rm.withForce()).run()
Expect(err).ToNot(HaveOccurred())
Expect(removeSession).To(Exit(0))
sysConnOutput, err = mb.setCmd(bm.withPodmanCommand([]string{"system", "connection", "list", "--format", "{{.Name}}--{{.Default}}"})).run()
Expect(err).ToNot(HaveOccurred())
Expect(sysConnOutput.outputToString()).To(ContainSubstring(name2 + "-root--true"))
})
It("Remove running machine", func() {