Skip to content

Commit

Permalink
List unhealthy containers when product tests health check fails
Browse files Browse the repository at this point in the history
  • Loading branch information
jkylling committed May 15, 2024
1 parent ab7fb93 commit 6612eff
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ private Environment tryStart()
log.info("Started environment %s with containers:\n%s", name, table.render());

// After deepStart all containers should be running and healthy
checkState(allContainersHealthy(containers), "Not all containers are running or healthy");
checkState(allContainersHealthy(containers), format("The containers %s are not running or healthy", unhealthyContainers(containers)));

listener.environmentStarted(this);
return this;
Expand Down Expand Up @@ -332,6 +332,13 @@ private static boolean allContainersHealthy(Iterable<DockerContainer> containers
.allMatch(Environment::containerIsHealthy);
}

private static List<DockerContainer> unhealthyContainers(Iterable<DockerContainer> containers)
{
return Streams.stream(containers)
.filter(Environment::containerIsHealthy)
.toList();
}

private static boolean containerIsHealthy(DockerContainer container)
{
if (container.isTemporary()) {
Expand Down

0 comments on commit 6612eff

Please sign in to comment.