From 39740c13f590957fbe4a8972d6bbffad88b9e982 Mon Sep 17 00:00:00 2001 From: Li Zhijian Date: Wed, 13 Jan 2021 13:27:07 +0800 Subject: [PATCH] :bug: internal: fix a possible temporary directory leak a temporary directory leak was found when running the tests Signed-off-by: Li Zhijian --- .../testing/integration/internal/process.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/internal/testing/integration/internal/process.go b/pkg/internal/testing/integration/internal/process.go index 99e2fdea3d..454354cb38 100644 --- a/pkg/internal/testing/integration/internal/process.go +++ b/pkg/internal/testing/integration/internal/process.go @@ -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 { @@ -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 }