pkg/machine/e2e: improve podman.exe match

The regex match would return a horrible error message and is way more
complicated then it should be. Simply check that .exe is not part of the
output.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2025-01-20 18:50:57 +01:00
parent dc3a7e56be
commit bdc195d641

View File

@@ -1,9 +1,6 @@
package e2e_test
import (
"regexp"
"slices"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gexec"
@@ -16,8 +13,6 @@ var _ = Describe("podman help", func() {
Expect(helpSession).Should(Exit(0))
// Verify `.exe` suffix doesn't present in the usage command string
helpMessages := helpSession.outputToStringSlice()
usageCmdIndex := slices.IndexFunc(helpMessages, func(helpMessage string) bool { return helpMessage == "Usage:" }) + 1
Expect(regexp.MustCompile(`\w\.exe\b`).MatchString(helpMessages[usageCmdIndex])).Should(BeFalse())
Expect(helpSession.outputToString()).ToNot(ContainSubstring(".exe"))
})
})