Skip to content

Commit

Permalink
qe: add podman command to path
Browse files Browse the repository at this point in the history
  • Loading branch information
jsliacan authored and adrianriobo committed Mar 14, 2024
1 parent 8f082a2 commit fcbb3e6
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions test/e2e/testsuite/testsuite.go
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,11 @@ func EnsureUserIsLoggedIntoClusterSucceedsOrFails(expected string) error {
}

func EnsureOCCommandIsAvailable() error {
return setOcEnv()
err := setOcEnv()
if err != nil {
return err
}
return setPodmanEnv()
}

func setOcEnv() error {
Expand All @@ -889,6 +893,13 @@ func setOcEnv() error {
return util.ExecuteCommandSucceedsOrFails("eval $(crc oc-env)", "succeeds")
}

func setPodmanEnv() error {
if runtime.GOOS == "windows" {
return util.ExecuteCommandSucceedsOrFails("crc podman-env | Invoke-Expression", "succeeds")
}
return util.ExecuteCommandSucceedsOrFails("eval $(crc podman-env)", "succeeds")
}

func SetConfigPropertyToValueSucceedsOrFails(property string, value string, expected string) error {
// Since network-mode is only supported on Linux, we skip this property test for non-linux platforms
if property == "network-mode" && runtime.GOOS != "linux" {
Expand Down Expand Up @@ -937,13 +948,13 @@ func DeletingPodSucceedsOrFails(expected string) error {
func PodmanCommandIsAvailable() error {

// Do what 'eval $(crc podman-env) would do
path := os.ExpandEnv("${HOME}/.crc/bin/oc:$PATH")
path := os.ExpandEnv("${HOME}/.crc/bin/podman:$PATH")
csshk := os.ExpandEnv("${HOME}/.crc/machines/crc/id_ecdsa")
dh := os.ExpandEnv("unix:///${HOME}/.crc/machines/crc/docker.sock")
ch := "ssh://[email protected]:2222/run/user/1000/podman/podman.sock"
if runtime.GOOS == "windows" {
userHomeDir, _ := os.UserHomeDir()
unexpandedPath := filepath.Join(userHomeDir, ".crc/bin/oc;${PATH}")
unexpandedPath := filepath.Join(userHomeDir, ".crc/bin/podman;${PATH}")
path = os.ExpandEnv(unexpandedPath)
csshk = filepath.Join(userHomeDir, ".crc/machines/crc/id_ecdsa")
dh = "npipe:////./pipe/crc-podman"
Expand Down

0 comments on commit fcbb3e6

Please sign in to comment.