mirror of
https://github.com/containers/podman.git
synced 2025-06-22 09:58:10 +08:00
Fix podman machine info test for hyperV
We do not guarantee that the amount of machines that exist on the system is 0 before running a test. Signed-off-by: Ashley Cui <acui@redhat.com>
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
package e2e_test
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/containers/podman/v4/pkg/domain/entities"
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
@ -27,12 +29,13 @@ var _ = Describe("podman machine info", func() {
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(infoSession).Should(Exit(0))
|
||||
|
||||
// Verify go template works and check for no running machines
|
||||
// Verify go template works and check for number of machines
|
||||
info = new(infoMachine)
|
||||
infoSession, err = mb.setCmd(info.withFormat("{{.Host.NumberOfMachines}}")).run()
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(infoSession).Should(Exit(0))
|
||||
Expect(infoSession.outputToString()).To(Equal("0"))
|
||||
numMachines, err := strconv.Atoi(infoSession.outputToString())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Create a machine and check if info has been updated
|
||||
i := new(initMachine)
|
||||
@ -44,7 +47,7 @@ var _ = Describe("podman machine info", func() {
|
||||
infoSession, err = mb.setCmd(info.withFormat("{{.Host.NumberOfMachines}}")).run()
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(infoSession).Should(Exit(0))
|
||||
Expect(infoSession.outputToString()).To(Equal("1"))
|
||||
Expect(infoSession.outputToString()).To(Equal(strconv.Itoa(numMachines + 1)))
|
||||
|
||||
// Check if json is in correct format
|
||||
infoSession, err = mb.setCmd(info.withFormat("json")).run()
|
||||
|
Reference in New Issue
Block a user