pkg/machine/e2e: wsl stop

allow the machine stop test to pass.

small change to WSL stop on an already stopped machine to allow for it
to behave like hyperv and qemu

Signed-off-by: Brent Baude <bbaude@redhat.com>
This commit is contained in:
Brent Baude 2023-09-25 16:14:23 -05:00
parent d2d121a389
commit 8bad842a45
2 changed files with 6 additions and 2 deletions

View File

@ -1,6 +1,8 @@
package e2e_test
import (
"fmt"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gexec"
@ -28,8 +30,9 @@ var _ = Describe("podman machine stop", func() {
})
It("Stop running machine", func() {
name := randomString()
i := new(initMachine)
session, err := mb.setCmd(i.withImagePath(mb.imagePath).withNow()).run()
session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath).withNow()).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))
@ -42,5 +45,6 @@ var _ = Describe("podman machine stop", func() {
stopAgain, err := mb.setCmd(stop).run()
Expect(err).ToNot(HaveOccurred())
Expect(stopAgain).To(Exit((0)))
Expect(stopAgain.outputToString()).To(ContainSubstring(fmt.Sprintf("Machine \"%s\" stopped successfully", name)))
})
})

View File

@ -1421,7 +1421,7 @@ func (v *MachineVM) Stop(name string, _ machine.StopOptions) error {
}
if !wsl || !sysd {
return fmt.Errorf("%q is not running", v.Name)
return nil
}
// Stop user-mode networking if enabled