mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-08 03:33:56 +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
|
package dockertools
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net"
|
"net"
|
||||||
@ -58,6 +59,21 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/util/sets"
|
"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 {
|
type fakeHTTP struct {
|
||||||
url string
|
url string
|
||||||
err error
|
err error
|
||||||
@ -80,7 +96,7 @@ func (f *fakeRuntimeHelper) GenerateRunContainerOptions(pod *v1.Pod, container *
|
|||||||
var opts kubecontainer.RunContainerOptions
|
var opts kubecontainer.RunContainerOptions
|
||||||
var err error
|
var err error
|
||||||
if len(container.TerminationMessagePath) != 0 {
|
if len(container.TerminationMessagePath) != 0 {
|
||||||
testPodContainerDir, err = ioutil.TempDir("", "fooPodContainerDir")
|
testPodContainerDir, err = ioutil.TempDir(testTempDir, "fooPodContainerDir")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user