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 authored and raunaqmorarka committed Jun 24, 2024
1 parent 2edfe09 commit 37311c6
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 37311c6

Please sign in to comment.