cleanup fooPodContainerDir in /tmp

parent b5da2d13
......@@ -17,6 +17,7 @@ limitations under the License.
package dockertools
import (
"flag"
"fmt"
"io/ioutil"
"net"
......@@ -58,6 +59,21 @@ import (
"k8s.io/kubernetes/pkg/util/sets"
)
var testTempDir string
func TestMain(m *testing.M) {
dir, err := ioutil.TempDir("", "dockertools")
if err != nil {
panic(err)
}
testTempDir = dir
flag.Parse()
status := m.Run()
os.RemoveAll(testTempDir)
os.Exit(status)
}
type fakeHTTP struct {
url string
err error
......@@ -80,7 +96,7 @@ func (f *fakeRuntimeHelper) GenerateRunContainerOptions(pod *v1.Pod, container *
var opts kubecontainer.RunContainerOptions
var err error
if len(container.TerminationMessagePath) != 0 {
testPodContainerDir, err = ioutil.TempDir("", "fooPodContainerDir")
testPodContainerDir, err = ioutil.TempDir(testTempDir, "fooPodContainerDir")
if err != nil {
return nil, err
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment