Move PATH setting to occur closer to the exec call

pull/9064/head
Thomas Stromberg 2020-08-24 11:10:07 -07:00
parent 55768061f0
commit e137ed2e0e
1 changed files with 6 additions and 9 deletions

View File

@ -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)
@ -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"