Skip to content

Commit

Permalink
Move PATH setting to occur closer to the exec call
Browse files Browse the repository at this point in the history
  • Loading branch information
tstromberg committed Aug 24, 2020
1 parent 5576806 commit e137ed2
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions test/integration/skaffold_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,6 @@ func TestSkaffold(t *testing.T) {
t.Fatalf("unable to determine abs path: %v", err)
}

oldPath := os.Getenv("PATH")
os.Setenv("PATH", fmt.Sprintf("%s:%s", filepath.Dir(abs), os.Getenv("PATH")))
defer func() {
os.Setenv("PATH", oldPath)
t.Logf("PATH is now %s", os.Getenv("PATH"))
}()

t.Logf("PATH is now %s", os.Getenv("PATH"))

if filepath.Base(Target()) != "minikube" {
new := filepath.Join(filepath.Dir(abs), "minikube")
t.Logf("copying %s to %s", Target(), new)
Expand All @@ -93,6 +84,12 @@ func TestSkaffold(t *testing.T) {
}
}

oldPath := os.Getenv("PATH")
os.Setenv("PATH", fmt.Sprintf("%s:%s", filepath.Dir(abs), os.Getenv("PATH")))
defer func() {
os.Setenv("PATH", oldPath)
}()

// make sure "skaffold run" exits without failure
cmd := exec.CommandContext(ctx, tf.Name(), "run", "--minikube-profile", profile, "--kube-context", profile, "--status-check=true", "--port-forward=false")
cmd.Dir = "testdata/skaffold"
Expand Down

0 comments on commit e137ed2

Please sign in to comment.