mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
testutil: daemon.Cleanup(): cleanup more directories
The storage-driver directory caused Jenkins cleanup to fail. While at it, also removing other directories that we do not include in the "bundles" that are stored as Jenkins artifacts. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
33a3680e08
commit
1a15a1a061
1 changed files with 34 additions and 0 deletions
|
@ -291,6 +291,7 @@ func (d *Daemon) Cleanup(t testing.TB) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
cleanupMount(t, d)
|
cleanupMount(t, d)
|
||||||
cleanupRaftDir(t, d)
|
cleanupRaftDir(t, d)
|
||||||
|
cleanupDaemonStorage(t, d)
|
||||||
cleanupNetworkNamespace(t, d)
|
cleanupNetworkNamespace(t, d)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -832,3 +833,36 @@ func cleanupRaftDir(t testing.TB, d *Daemon) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// cleanupDaemonStorage removes the daemon's storage directory.
|
||||||
|
//
|
||||||
|
// Note that we don't delete the whole directory, as some files (e.g. daemon
|
||||||
|
// logs) are collected for inclusion in the "bundles" that are stored as Jenkins
|
||||||
|
// artifacts.
|
||||||
|
//
|
||||||
|
// We currently do not include container logs in the bundles, so this also
|
||||||
|
// removes the "containers" sub-directory.
|
||||||
|
func cleanupDaemonStorage(t testing.TB, d *Daemon) {
|
||||||
|
t.Helper()
|
||||||
|
dirs := []string{
|
||||||
|
"builder",
|
||||||
|
"buildkit",
|
||||||
|
"containers",
|
||||||
|
"image",
|
||||||
|
"network",
|
||||||
|
"plugins",
|
||||||
|
"tmp",
|
||||||
|
"trust",
|
||||||
|
"volumes",
|
||||||
|
// note: this assumes storage-driver name matches the subdirectory,
|
||||||
|
// which is currently true, but not guaranteed.
|
||||||
|
d.storageDriver,
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, p := range dirs {
|
||||||
|
dir := filepath.Join(d.Root, p)
|
||||||
|
if err := os.RemoveAll(dir); err != nil {
|
||||||
|
t.Logf("[%s] error removing %v: %v", d.id, dir, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue