mirror of https://github.com/docker/docs.git
Merge pull request #8998 from yoheiueda/dont-remove-tmpdir
Fix the unit test not to remove /tmp
This commit is contained in:
commit
ff911d5f34
|
@ -38,12 +38,13 @@ BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"`)
|
||||||
)
|
)
|
||||||
|
|
||||||
dir := os.TempDir()
|
dir := os.TempDir()
|
||||||
|
etcOsRelease = filepath.Join(dir, "etcOsRelease")
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
|
os.Remove(etcOsRelease)
|
||||||
etcOsRelease = backup
|
etcOsRelease = backup
|
||||||
os.RemoveAll(dir)
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
etcOsRelease = filepath.Join(dir, "etcOsRelease")
|
|
||||||
for expect, osRelease := range map[string][]byte{
|
for expect, osRelease := range map[string][]byte{
|
||||||
"Ubuntu 14.04 LTS": ubuntuTrusty,
|
"Ubuntu 14.04 LTS": ubuntuTrusty,
|
||||||
"Gentoo/Linux": gentoo,
|
"Gentoo/Linux": gentoo,
|
||||||
|
@ -92,13 +93,13 @@ func TestIsContainerized(t *testing.T) {
|
||||||
)
|
)
|
||||||
|
|
||||||
dir := os.TempDir()
|
dir := os.TempDir()
|
||||||
defer func() {
|
|
||||||
proc1Cgroup = backup
|
|
||||||
os.RemoveAll(dir)
|
|
||||||
}()
|
|
||||||
|
|
||||||
proc1Cgroup = filepath.Join(dir, "proc1Cgroup")
|
proc1Cgroup = filepath.Join(dir, "proc1Cgroup")
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
os.Remove(proc1Cgroup)
|
||||||
|
proc1Cgroup = backup
|
||||||
|
}()
|
||||||
|
|
||||||
if err := ioutil.WriteFile(proc1Cgroup, nonContainerizedProc1Cgroup, 0600); err != nil {
|
if err := ioutil.WriteFile(proc1Cgroup, nonContainerizedProc1Cgroup, 0600); err != nil {
|
||||||
t.Fatalf("failed to write to %s: %v", proc1Cgroup, err)
|
t.Fatalf("failed to write to %s: %v", proc1Cgroup, err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue