integration: clean up unreferenced hs- networks (#2534)

This commit is contained in:
Kristoffer Dalby 2025-04-18 12:06:28 +02:00 committed by GitHub
parent 710d75367e
commit f783555469
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 29 additions and 1 deletions

View file

@ -165,6 +165,11 @@ func NewScenario(spec ScenarioSpec) (*Scenario, error) {
return nil, fmt.Errorf("could not connect to docker: %w", err)
}
// Opportunity to clean up unreferenced networks.
// This might be a no op, but it is worth a try as we sometime
// dont clean up nicely after ourselves.
dockertestutil.CleanUnreferencedNetworks(pool)
if spec.MaxWait == 0 {
pool.MaxWait = dockertestMaxWait()
} else {
@ -292,6 +297,8 @@ func (s *Scenario) Services(name string) ([]*dockertest.Resource, error) {
}
func (s *Scenario) ShutdownAssertNoPanics(t *testing.T) {
defer dockertestutil.CleanUnreferencedNetworks(s.pool)
s.controlServers.Range(func(_ string, control ControlServer) bool {
stdoutPath, stderrPath, err := control.Shutdown()
if err != nil {