mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 18:24:07 +00:00
cleanup fooPodContainerDir in /tmp
Signed-off-by: Jess Frazelle <acidburn@google.com>
This commit is contained in:
parent
b5da2d13a6
commit
7db9c8b454
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user