test(integration): prune orphaned networks to avoid subnet exhaustion

This commit is contained in:
Julien Neuhart
2026-05-29 14:32:50 +02:00
parent 9ea0e82525
commit 08181f8550
3 changed files with 54 additions and 3 deletions

View File

@@ -3,6 +3,7 @@
package integration
import (
"context"
"fmt"
"os"
"runtime"
@@ -48,6 +49,14 @@ func TestMain(m *testing.M) {
// Reset the failure collector before each run.
scenario.ResetFailedScenarios()
// Reclaim subnets leaked by prior runs or failed container starts
// before they exhaust Docker's predefined address pools.
if deleted, err := scenario.PruneOrphanedNetworks(context.Background()); err != nil {
fmt.Fprintf(colors.Colored(os.Stdout), "warning: prune orphaned networks: %v\n", err)
} else if deleted > 0 {
fmt.Fprintf(colors.Colored(os.Stdout), "pruned %d orphaned network(s)\n", deleted)
}
code := godog.TestSuite{
Name: "integration",
ScenarioInitializer: scenario.InitializeScenario,