Skip to content

Commit

Permalink
Merge pull request containers#19668 from ashley-cui/teststart
Browse files Browse the repository at this point in the history
Update machine start tests
  • Loading branch information
openshift-merge-robot authored Aug 18, 2023
2 parents a161e8b + 8b29901 commit 884e5f6
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions pkg/machine/e2e/start_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,34 @@ var _ = Describe("podman machine start", func() {
Expect(startSession).To(Exit(0))
Expect(startSession.outputToStringSlice()).To(HaveLen(1))
})

It("bad start name", func() {
i := startMachine{}
reallyLongName := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
session, err := mb.setName(reallyLongName).setCmd(&i).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(125))
Expect(session.errorToString()).To(ContainSubstring("VM does not exist"))
})

It("start machine already started", func() {
i := new(initMachine)
session, err := mb.setCmd(i.withImagePath(mb.imagePath)).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))
s := new(startMachine)
startSession, err := mb.setCmd(s).run()
Expect(err).ToNot(HaveOccurred())
Expect(startSession).To(Exit(0))

info, ec, err := mb.toQemuInspectInfo()
Expect(err).ToNot(HaveOccurred())
Expect(ec).To(BeZero())
Expect(info[0].State).To(Equal(machine.Running))

startSession, err = mb.setCmd(s).run()
Expect(err).ToNot(HaveOccurred())
Expect(startSession).To(Exit(125))
Expect(startSession.errorToString()).To(ContainSubstring("VM already running or starting"))
})
})

0 comments on commit 884e5f6

Please sign in to comment.