From 0f2af169ad3003e8e6dbf8d1a740590f3c2f369a Mon Sep 17 00:00:00 2001 From: Mahmood Ali Date: Wed, 30 Sep 2020 12:02:36 -0400 Subject: [PATCH] tests: copy permissions when copying files On the failover path, copy the permission bits (a.k.a. file mode), specially the execution bit. --- drivers/shared/executor/executor_test.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/shared/executor/executor_test.go b/drivers/shared/executor/executor_test.go index 200fb323e..cd15321b6 100644 --- a/drivers/shared/executor/executor_test.go +++ b/drivers/shared/executor/executor_test.go @@ -495,7 +495,10 @@ func copyFile(t *testing.T, src, dst string) { require.NoErrorf(t, err, "copying %v -> %v", src, dst) defer in.Close() - out, err := os.Create(dst) + ins, err := in.Stat() + require.NoErrorf(t, err, "copying %v -> %v", src, dst) + + out, err := os.OpenFile(dst, os.O_RDWR|os.O_CREATE, ins.Mode()) require.NoErrorf(t, err, "copying %v -> %v", src, dst) defer func() { if err := out.Close(); err != nil { @@ -633,6 +636,8 @@ func TestExecutor_Start_NonExecutableBinaries(pt *testing.T) { } return true, nil }, func(err error) { + stderr := strings.TrimSpace(string(testExecCmd.stderr.String())) + t.Logf("stderr: %v", stderr) require.NoError(err) }) })