Skip to content

Commit

Permalink
Modify machine "Remove machine" test
Browse files Browse the repository at this point in the history
Modifies the "Remove machine" test to verify the system connections are
handled properly on removal.

Signed-off-by: Jake Correnti <[email protected]>
  • Loading branch information
jakecorrenti committed Sep 25, 2024
1 parent 24deec8 commit e9b8564
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions pkg/machine/e2e/rm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit e9b8564

Please sign in to comment.