Skip to content

Commit

Permalink
Modify tmp dir logic
Browse files Browse the repository at this point in the history
  • Loading branch information
mmulholla committed Feb 10, 2021
1 parent 3482ad3 commit 79f4b1d
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions tests/v2/utils/test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,11 @@ func init() {
// Returns the name of the created directory.
func CreateTempDir(subdir string) string {
tempDir := tmpDir + subdir + "/"
if _, err := os.Stat(tempDir); os.IsNotExist(err) {
if err = os.Mkdir(tempDir, 0755); err != nil {
LogErrorMessage(fmt.Sprintf("Failed to create temp directory %s will use %s : %v", tempDir, tmpDir, err))
// if cannot create subdirectory just use the base tmp directory
tempDir = tmpDir
}
} else if err != nil {
var err error
if _, err = os.Stat(tempDir); os.IsNotExist(err) {
err = os.Mkdir(tempDir, 0755)
}
if err != nil {
// if cannot create subdirectory just use the base tmp directory
LogErrorMessage(fmt.Sprintf("Failed to create temp directory %s will use %s : %v", tempDir, tmpDir, err))
tempDir = tmpDir
Expand Down

0 comments on commit 79f4b1d

Please sign in to comment.