pkg/machine/e2e: fix unparam warnings

This one:

> pkg/machine/e2e/config_windows_test.go:42:56: runSystemCommand - timeout always receives defaultTimeout (600000000000) (unparam)
> func runSystemCommand(binary string, cmdArgs []string, timeout time.Duration, wait bool) (*machineSession, error) {
>                                                        ^

and, subsequently, this one:

> pkg/machine/e2e/config_windows_test.go:41:56: runSystemCommand - wait always receives true (unparam)
> func runSystemCommand(binary string, cmdArgs []string, wait bool) (*machineSession, error) {
>                                                        ^

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin
2025-03-29 19:53:33 -07:00
parent 7c175064da
commit c1f9c0b127
2 changed files with 7 additions and 10 deletions

View File

@ -4,7 +4,6 @@ import (
"fmt"
"os/exec"
"strings"
"time"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega/gexec"
@ -39,7 +38,7 @@ func getOtherProvider() string {
return ""
}
func runSystemCommand(binary string, cmdArgs []string, timeout time.Duration, wait bool) (*machineSession, error) {
func runSystemCommand(binary string, cmdArgs []string) (*machineSession, error) {
GinkgoWriter.Println(binary + " " + strings.Join(cmdArgs, " "))
c := exec.Command(binary, cmdArgs...)
session, err := Start(c, GinkgoWriter, GinkgoWriter)
@ -48,8 +47,6 @@ func runSystemCommand(binary string, cmdArgs []string, timeout time.Duration, wa
return nil, err
}
ms := machineSession{session}
if wait {
ms.waitWithTimeout(timeout)
}
ms.waitWithTimeout(defaultTimeout)
return &ms, nil
}

View File

@ -28,12 +28,12 @@ var _ = Describe("podman machine init - windows only", func() {
Expect(session).To(Exit(0))
defer func() {
_, err := runSystemCommand(wutil.FindWSL(), []string{"--terminate", "podman-net-usermode"}, defaultTimeout, true)
_, err := runSystemCommand(wutil.FindWSL(), []string{"--terminate", "podman-net-usermode"})
if err != nil {
fmt.Println("unable to terminate podman-net-usermode")
}
_, err = runSystemCommand(wutil.FindWSL(), []string{"--unregister", "podman-net-usermode"}, defaultTimeout, true)
_, err = runSystemCommand(wutil.FindWSL(), []string{"--unregister", "podman-net-usermode"})
if err != nil {
fmt.Println("unable to unregister podman-net-usermode")
}
@ -106,17 +106,17 @@ var _ = Describe("podman machine init - windows only", func() {
// a vm outside the context of podman-machine and also
// so we dont have to download a distribution from microsoft
// servers
exportSession, err := runSystemCommand(wutil.FindWSL(), []string{"--export", "podman-foobarexport", exportedPath}, defaultTimeout, true)
exportSession, err := runSystemCommand(wutil.FindWSL(), []string{"--export", "podman-foobarexport", exportedPath})
Expect(err).ToNot(HaveOccurred())
Expect(exportSession).To(Exit(0))
// importing the machine and creating a vm
importSession, err := runSystemCommand(wutil.FindWSL(), []string{"--import", distName, distrDir, exportedPath}, defaultTimeout, true)
importSession, err := runSystemCommand(wutil.FindWSL(), []string{"--import", distName, distrDir, exportedPath})
Expect(err).ToNot(HaveOccurred())
Expect(importSession).To(Exit(0))
defer func() {
_, err := runSystemCommand(wutil.FindWSL(), []string{"--unregister", distName}, defaultTimeout, true)
_, err := runSystemCommand(wutil.FindWSL(), []string{"--unregister", distName})
if err != nil {
fmt.Println("unable to remove bogus wsl instance")
}