mirror of
https://github.com/containers/podman.git
synced 2026-03-28 03:22:18 -04:00
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>
53 lines
1.4 KiB
Go
53 lines
1.4 KiB
Go
package e2e_test
|
|
|
|
import (
|
|
"fmt"
|
|
"os/exec"
|
|
"strings"
|
|
|
|
. "github.com/onsi/ginkgo/v2"
|
|
. "github.com/onsi/gomega/gexec"
|
|
|
|
"github.com/containers/podman/v5/pkg/machine/define"
|
|
)
|
|
|
|
const podmanBinary = "../../../bin/windows/podman.exe"
|
|
|
|
// pgrep emulates the pgrep linux command
|
|
func pgrep(n string) (string, error) {
|
|
// add filter to find the process and do no display a header
|
|
args := []string{"/fi", fmt.Sprintf("IMAGENAME eq %s", n), "/nh"}
|
|
out, err := exec.Command("tasklist.exe", args...).Output()
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
strOut := string(out)
|
|
// in pgrep, if no running process is found, it exits 1 and the output is zilch
|
|
if strings.Contains(strOut, "INFO: No tasks are running which match the specified search") {
|
|
return "", fmt.Errorf("no task found")
|
|
}
|
|
return strOut, nil
|
|
}
|
|
|
|
func getOtherProvider() string {
|
|
if isVmtype(define.WSLVirt) {
|
|
return "hyperv"
|
|
} else if isVmtype(define.HyperVVirt) {
|
|
return "wsl"
|
|
}
|
|
return ""
|
|
}
|
|
|
|
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)
|
|
if err != nil {
|
|
Fail(fmt.Sprintf("Unable to start session: %q", err))
|
|
return nil, err
|
|
}
|
|
ms := machineSession{session}
|
|
ms.waitWithTimeout(defaultTimeout)
|
|
return &ms, nil
|
|
}
|