mirror of
https://github.com/containers/podman.git
synced 2025-07-03 09:17:15 +08:00
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:
@ -4,7 +4,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
|
||||||
|
|
||||||
. "github.com/onsi/ginkgo/v2"
|
. "github.com/onsi/ginkgo/v2"
|
||||||
. "github.com/onsi/gomega/gexec"
|
. "github.com/onsi/gomega/gexec"
|
||||||
@ -39,7 +38,7 @@ func getOtherProvider() string {
|
|||||||
return ""
|
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, " "))
|
GinkgoWriter.Println(binary + " " + strings.Join(cmdArgs, " "))
|
||||||
c := exec.Command(binary, cmdArgs...)
|
c := exec.Command(binary, cmdArgs...)
|
||||||
session, err := Start(c, GinkgoWriter, GinkgoWriter)
|
session, err := Start(c, GinkgoWriter, GinkgoWriter)
|
||||||
@ -48,8 +47,6 @@ func runSystemCommand(binary string, cmdArgs []string, timeout time.Duration, wa
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
ms := machineSession{session}
|
ms := machineSession{session}
|
||||||
if wait {
|
ms.waitWithTimeout(defaultTimeout)
|
||||||
ms.waitWithTimeout(timeout)
|
|
||||||
}
|
|
||||||
return &ms, nil
|
return &ms, nil
|
||||||
}
|
}
|
||||||
|
@ -28,12 +28,12 @@ var _ = Describe("podman machine init - windows only", func() {
|
|||||||
Expect(session).To(Exit(0))
|
Expect(session).To(Exit(0))
|
||||||
|
|
||||||
defer func() {
|
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 {
|
if err != nil {
|
||||||
fmt.Println("unable to terminate podman-net-usermode")
|
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 {
|
if err != nil {
|
||||||
fmt.Println("unable to unregister podman-net-usermode")
|
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
|
// a vm outside the context of podman-machine and also
|
||||||
// so we dont have to download a distribution from microsoft
|
// so we dont have to download a distribution from microsoft
|
||||||
// servers
|
// 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(err).ToNot(HaveOccurred())
|
||||||
Expect(exportSession).To(Exit(0))
|
Expect(exportSession).To(Exit(0))
|
||||||
|
|
||||||
// importing the machine and creating a vm
|
// 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(err).ToNot(HaveOccurred())
|
||||||
Expect(importSession).To(Exit(0))
|
Expect(importSession).To(Exit(0))
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
_, err := runSystemCommand(wutil.FindWSL(), []string{"--unregister", distName}, defaultTimeout, true)
|
_, err := runSystemCommand(wutil.FindWSL(), []string{"--unregister", distName})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("unable to remove bogus wsl instance")
|
fmt.Println("unable to remove bogus wsl instance")
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user