makeTempDir creates a file with a semi-unique name in the OS temp directory. It should be based on the name of the test, to keep parallel tests from colliding, and must be cleaned up after the test is finished.
(name string, t testing.TB)
| 711 | // It should be based on the name of the test, to keep parallel tests from |
| 712 | // colliding, and must be cleaned up after the test is finished. |
| 713 | func makeTempDir(name string, t testing.TB) string { |
| 714 | dir := time.Now().Format(name + backupTimeFormat) |
| 715 | dir = filepath.Join(os.TempDir(), dir) |
| 716 | isNilUp(os.Mkdir(dir, 0700), t, 1) |
| 717 | return dir |
| 718 | } |
| 719 | |
| 720 | // existsWithContent checks that the given file exists and has the correct content. |
| 721 | func existsWithContent(path string, content []byte, t testing.TB) { |
no test coverage detected
searching dependent graphs…