mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-14 19:32:15 +01:00
test(integration): prune orphaned networks to avoid subnet exhaustion
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user