From cd1af85eb00e1ef86f5a813bf0f2ebbd33c9812e Mon Sep 17 00:00:00 2001 From: Martin Jirku Date: Sat, 2 Dec 2023 22:01:32 +0100 Subject: [PATCH] minikube cp will create nonexisten directory instead of fail Signed-off-by: Martin Jirku --- pkg/minikube/command/ssh_runner.go | 2 +- test/integration/functional_test.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/minikube/command/ssh_runner.go b/pkg/minikube/command/ssh_runner.go index 0ff69c58cc5f..6ccd2dfd5fca 100644 --- a/pkg/minikube/command/ssh_runner.go +++ b/pkg/minikube/command/ssh_runner.go @@ -406,7 +406,7 @@ func (s *SSHRunner) Copy(f assets.CopyableFile) error { return nil }) - scp := fmt.Sprintf("sudo test -d %s && sudo scp -t %s", f.GetTargetDir(), f.GetTargetDir()) + scp := fmt.Sprintf("sudo mkdir -p %s && sudo scp -t %s", f.GetTargetDir(), f.GetTargetDir()) mtime, err := f.GetModTime() if err != nil { klog.Infof("error getting modtime for %s: %v", dst, err) diff --git a/test/integration/functional_test.go b/test/integration/functional_test.go index 33eeff113050..c11a228c1a27 100644 --- a/test/integration/functional_test.go +++ b/test/integration/functional_test.go @@ -1774,6 +1774,9 @@ func validateCpCmd(ctx context.Context, t *testing.T, profile string) { tmpPath := filepath.Join(tmpDir, "cp-test.txt") testCpCmd(ctx, t, profile, profile, dstPath, "", tmpPath) + + // copy to nonexistent directory structure + testCpCmd(ctx, t, profile, "", srcPath, "", "/tmp/does/not/exist/cp-test.txt") } // validateMySQL validates a minimalist MySQL deployment