Files
podman/pkg/machine/e2e/config_windows_test.go
Brent Baude 5e1c2f8d7d Machine init --provider
Add the ability for users to override the default provider when creating mahcines.  The new flag is `--provider` and allows you to specifiy a valid vmtype for the platform.  This PR also removes the previous list test where we tested listing all providers.  I added a PR for testing --provider which includes a standard `machine ls` which defaults now to showing all providers.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2025-10-29 07:59:34 -05:00

43 lines
1.1 KiB
Go

package e2e_test
import (
"fmt"
"os/exec"
"strings"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega/gexec"
)
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 runWslCommand(cmdArgs []string) (*machineSession, error) {
binary := "wsl"
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
}