From e9b8564690d49c54a4d32c85161776e06bede250 Mon Sep 17 00:00:00 2001 From: Jake Correnti Date: Thu, 12 Sep 2024 15:08:25 -0400 Subject: [PATCH] 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 --- pkg/machine/e2e/rm_test.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/pkg/machine/e2e/rm_test.go b/pkg/machine/e2e/rm_test.go index 210e6ed09f..119c5b4b7a 100644 --- a/pkg/machine/e2e/rm_test.go +++ b/pkg/machine/e2e/rm_test.go @@ -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() {