mirror of
https://github.com/containers/podman.git
synced 2025-11-30 01:58:46 +08:00
pkg/machine/e2e: improve "list machine from all providers"
The test pulls a big disk image every time which is slow. I see no good way around that. Let's try to use /dev/null as image as we do not have to run the VM at all and just can pass a NOP file to make the init command happy. That pull of that image seems to take over 2m so we safe quite a lot. Also update the matcher for the slice. BeTrue() produces horrible errors. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
@@ -192,8 +192,13 @@ var _ = Describe("podman machine list", func() {
|
|||||||
os.Setenv("CONTAINERS_MACHINE_PROVIDER", getOtherProvider())
|
os.Setenv("CONTAINERS_MACHINE_PROVIDER", getOtherProvider())
|
||||||
defer os.Setenv("CONTAINERS_MACHINE_PROVIDER", currprovider)
|
defer os.Setenv("CONTAINERS_MACHINE_PROVIDER", currprovider)
|
||||||
|
|
||||||
// this may take a long time - we're not pre-fetching this image
|
|
||||||
othermach := new(initMachine)
|
othermach := new(initMachine)
|
||||||
|
if !isWSL() && !isVmtype(define.HyperVVirt) {
|
||||||
|
// This would need to fetch a new image as we cannot use the image from the other provider,
|
||||||
|
// to avoid big pulls which are slow and flaky use /dev/null which works on macos and qemu
|
||||||
|
// as we never run the image if we do not start it.
|
||||||
|
othermach.withImage(os.DevNull)
|
||||||
|
}
|
||||||
session, err := mb.setName("otherprovider").setCmd(othermach).run()
|
session, err := mb.setName("otherprovider").setCmd(othermach).run()
|
||||||
// make sure to remove machine from other provider later
|
// make sure to remove machine from other provider later
|
||||||
defer func() {
|
defer func() {
|
||||||
@@ -222,8 +227,7 @@ var _ = Describe("podman machine list", func() {
|
|||||||
listNames := listSession.outputToStringSlice()
|
listNames := listSession.outputToStringSlice()
|
||||||
stripAsterisk(listNames)
|
stripAsterisk(listNames)
|
||||||
Expect(listNames).To(HaveLen(2))
|
Expect(listNames).To(HaveLen(2))
|
||||||
Expect(slices.Contains(listNames, "otherprovider")).To(BeTrue())
|
Expect(listNames).To(ContainElements("otherprovider", name))
|
||||||
Expect(slices.Contains(listNames, name)).To(BeTrue())
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user