Change driver permission

pull/5085/head
josedonizetti 2019-09-10 22:00:25 -03:00
parent 3bb79f6878
commit 5232043d33
1 changed files with 13 additions and 5 deletions

View File

@ -55,17 +55,25 @@ func TestDriverInstallOrUpdate(t *testing.T) {
fmt.Printf("InstallOrUpdate temp dir: %s\n", dir)
_, err = os.Stat(filepath.Join(tc.path, "docker-machine-driver-kvm2"))
pwd, err := os.Getwd()
if err != nil {
t.Fatalf("Error not expected when getting working directory. test: %s, got: %v", tc.name, err)
}
path := filepath.Join(pwd, tc.path)
fmt.Printf("InstallOrUpdate path: %s\n", path)
_, err = os.Stat(filepath.Join(path, "docker-machine-driver-kvm2"))
if err != nil {
t.Fatalf("Expected driver to exist. test: %s, got: %v", tc.name, err)
}
pwd, err := os.Getwd()
// change permission to allow driver to be executable
err = os.Chmod(filepath.Join(path, "docker-machine-driver-kvm2"), 0777)
if err != nil {
t.Fatalf("Not expected error getting working directory. test: %s, got: %v", tc.name, err)
t.Fatalf("Expected not expected when changing driver permission. test: %s, got: %v", tc.name, err)
}
path := filepath.Join(pwd, tc.path)
fmt.Printf("InstallOrUpdate path: %s\n", path)
os.Setenv("PATH", fmt.Sprintf("%s:%s", path, os.Getenv("PATH")))
fmt.Printf("InstallOrUpdate PATH: %s\n", os.Getenv("PATH"))