Skip to content

Commit

Permalink
🐛 internal: fix a possible temporary directory leak
Browse files Browse the repository at this point in the history
a temporary directory leak was found when running the tests

Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
  • Loading branch information
zhijianli88 committed Feb 18, 2021
1 parent 3c5b358 commit 39740c1
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions pkg/internal/testing/integration/internal/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@ func DoDefaulting(
defaults.URL = *listenURL
}

if path == "" {
if name == "" {
return DefaultedProcessInput{}, fmt.Errorf("must have at least one of name or path")
}
defaults.Path = BinPathFinder(name)
}

if dir == "" {
newDir, err := ioutil.TempDir("", "k8s_test_framework_")
if err != nil {
Expand All @@ -96,13 +103,6 @@ func DoDefaulting(
defaults.DirNeedsCleaning = true
}

if path == "" {
if name == "" {
return DefaultedProcessInput{}, fmt.Errorf("must have at least one of name or path")
}
defaults.Path = BinPathFinder(name)
}

if startTimeout == 0 {
defaults.StartTimeout = 20 * time.Second
}
Expand Down

0 comments on commit 39740c1

Please sign in to comment.