From 41e51f4738319d54ee3a03fa87cec0d2fb57c3c1 Mon Sep 17 00:00:00 2001
From: Brent Baude <bbaude@redhat.com>
Date: Sun, 24 Sep 2023 10:00:56 -0500
Subject: [PATCH] hyperv: machine e2e tests for set command

The usermode networking scenario is only for WSL.  Hyperv cannot run it.

Signed-off-by: Brent Baude <bbaude@redhat.com>
---
 pkg/machine/e2e/config_test.go | 14 --------------
 pkg/machine/e2e/set_test.go    |  6 ++++--
 2 files changed, 4 insertions(+), 16 deletions(-)

diff --git a/pkg/machine/e2e/config_test.go b/pkg/machine/e2e/config_test.go
index 540d0f30bc..06d6a50003 100644
--- a/pkg/machine/e2e/config_test.go
+++ b/pkg/machine/e2e/config_test.go
@@ -6,7 +6,6 @@ import (
 	"os"
 	"os/exec"
 	"path/filepath"
-	"runtime"
 	"strings"
 	"time"
 
@@ -202,16 +201,3 @@ func (matcher *ValidJSONMatcher) FailureMessage(actual interface{}) (message str
 func (matcher *ValidJSONMatcher) NegatedFailureMessage(actual interface{}) (message string) {
 	return format.Message(actual, "to _not_ be valid JSON")
 }
-
-func checkReason(reason string) {
-	if len(reason) < 5 {
-		panic("Test must specify a reason to skip")
-	}
-}
-
-func SkipIfNotWindows(reason string) {
-	checkReason(reason)
-	if runtime.GOOS != "windows" {
-		Skip("[not windows]: " + reason)
-	}
-}
diff --git a/pkg/machine/e2e/set_test.go b/pkg/machine/e2e/set_test.go
index eb62de77f3..8ecc0d2afb 100644
--- a/pkg/machine/e2e/set_test.go
+++ b/pkg/machine/e2e/set_test.go
@@ -5,6 +5,7 @@ import (
 	"strconv"
 	"strings"
 
+	"github.com/containers/podman/v4/pkg/machine"
 	. "github.com/onsi/ginkgo/v2"
 	. "github.com/onsi/gomega"
 	. "github.com/onsi/gomega/gexec"
@@ -139,8 +140,9 @@ var _ = Describe("podman machine set", func() {
 	})
 
 	It("set user mode networking", func() {
-		SkipIfNotWindows("Setting user mode networking is only honored on Windows")
-
+		if testProvider.VMType() != machine.WSLVirt {
+			Skip("Test is only for WSL")
+		}
 		name := randomString()
 		i := new(initMachine)
 		session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath)).run()