Skip to content

Commit

Permalink
chore: update linux smoke tests to only remove networks in debug build (
Browse files Browse the repository at this point in the history
#2088)

* chore: update linux smoke tests to only remove networks in debug build

* experiment: Create a kafka broker container for each kafka test app

* Revert previous docker-compose change; add logging on container cleanup
  • Loading branch information
tippmar-nr authored Nov 21, 2023
1 parent 09ab29d commit bb41cdc
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ public override void Shutdown()
private void CleanupContainer()
{
Console.WriteLine($"[{AppName} {DateTime.Now}] Cleaning up container and images related to {ContainerName} container.");
TestLogger?.WriteLine($"[{AppName}] Cleaning up container and images related to {ContainerName} container.");
// ensure there's no stray containers or images laying around
Process.Start("docker", $"container rm --force {ContainerName}");
Process.Start("docker", $"image rm --force {ContainerName}");
Expand All @@ -197,12 +198,16 @@ private void CleanupContainer()
{
foreach (var dep in DockerDependencies)
{
Console.WriteLine($"[{AppName} {DateTime.Now}] Removing dependent container: {dep}.");
TestLogger?.WriteLine($"[{AppName}] Removing dependent container: {dep}.");
Process.Start("docker", $"container rm --force {dep}");
}
}

#if DEBUG
// Cleanup the networks with no attached containers. Mainly for testings on dev laptops - they can build up and block runs.
Process.Start("docker", "network prune -f");
#endif
}

protected virtual void WaitForAppServerToStartListening(Process process, bool captureStandardOutput)
Expand Down

0 comments on commit bb41cdc

Please sign in to comment.