Force file sync after writing file via container and wait for pod to

disappear after removal in test
This commit is contained in:
David Zhu
2019-10-29 17:41:43 -07:00
parent b6c8f4916d
commit e3d2432e01
2 changed files with 11 additions and 23 deletions

View File

@@ -481,7 +481,7 @@ func (f *Framework) WriteFileViaContainer(podName, containerName string, path st
return fmt.Errorf("Unsupported character in string to write: %v", c)
}
}
command := fmt.Sprintf("echo '%s' > '%s'", contents, path)
command := fmt.Sprintf("echo '%s' > '%s'; sync", contents, path)
stdout, stderr, err := kubectlExecWithRetry(f.Namespace.Name, podName, containerName, "--", "/bin/sh", "-c", command)
if err != nil {
Logf("error running kubectl exec to write file: %v\nstdout=%v\nstderr=%v)", err, string(stdout), string(stderr))