From bdc195d641fabed6764de59f22a601e059e153d7 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Mon, 20 Jan 2025 18:50:57 +0100 Subject: [PATCH] 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 --- pkg/machine/e2e/help_test.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/pkg/machine/e2e/help_test.go b/pkg/machine/e2e/help_test.go index 48f653c5ca..46cc31fe10 100644 --- a/pkg/machine/e2e/help_test.go +++ b/pkg/machine/e2e/help_test.go @@ -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")) }) })