diff --git a/pkg/machine/e2e/stop_test.go b/pkg/machine/e2e/stop_test.go index a1db7b975d..28d17e4772 100644 --- a/pkg/machine/e2e/stop_test.go +++ b/pkg/machine/e2e/stop_test.go @@ -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))) }) }) diff --git a/pkg/machine/wsl/machine.go b/pkg/machine/wsl/machine.go index 25d6864b75..80ae9f3da0 100644 --- a/pkg/machine/wsl/machine.go +++ b/pkg/machine/wsl/machine.go @@ -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