Creating a tracking issue for #36538 (comment)
We should update testenv.ProtectAll() and testenv.Clean() to also cleanup services, so that integration-tests don't have to clean up services after running the tests.
Similar to the way containers, networks, and other resources are currently handled;
|
// ProtectAll protects the existing environment (containers, images, networks, |
|
// volumes, and, on Linux, plugins) from being cleaned up at the end of test |
|
// runs |
|
func ProtectAll(t testingT, testEnv *Execution) { |
|
ProtectContainers(t, testEnv) |
|
ProtectImages(t, testEnv) |
|
ProtectNetworks(t, testEnv) |
|
ProtectVolumes(t, testEnv) |
|
if testEnv.OSType == "linux" { |
|
ProtectPlugins(t, testEnv) |
|
} |
|
} |
|
// Clean the environment, preserving protected objects (images, containers, ...) |
|
// and removing everything else. It's meant to run after any tests so that they don't |
|
// depend on each others. |
|
func (e *Execution) Clean(t testingT) { |
|
client := e.APIClient() |
|
|
|
platform := e.OSType |
|
if (platform != "windows") || (platform == "windows" && e.DaemonInfo.Isolation == "hyperv") { |
|
unpauseAllContainers(t, client) |
|
} |
|
deleteAllContainers(t, client, e.protectedElements.containers) |
|
deleteAllImages(t, client, e.protectedElements.images) |
|
deleteAllVolumes(t, client, e.protectedElements.volumes) |
|
deleteAllNetworks(t, client, platform, e.protectedElements.networks) |
|
if platform == "linux" { |
|
deleteAllPlugins(t, client, e.protectedElements.plugins) |
|
} |
|
} |
labelling with both "beginner" and "intermediate"; it's probably somewhere in between 😄
Creating a tracking issue for #36538 (comment)
We should update
testenv.ProtectAll()andtestenv.Clean()to also cleanup services, so that integration-tests don't have to clean up services after running the tests.Similar to the way containers, networks, and other resources are currently handled;
moby/internal/test/environment/protect.go
Lines 32 to 43 in 3e0299f
moby/internal/test/environment/clean.go
Lines 25 to 42 in 3e0299f
labelling with both "beginner" and "intermediate"; it's probably somewhere in between 😄