mariotoffia / FluentDocker

Use docker, docker-compose local and remote in tests and your .NET core/full framework apps via a FluentAPI
Apache License 2.0
1.33k stars 98 forks source link

Docker Compose Up --wait support #308

Open bzwieratinnovadis opened 9 months ago

bzwieratinnovadis commented 9 months ago

This library is great, but I am missing one feature that would make it much better. Currently in order to wait for a service to become healthy, I need to use the .WaitForHttp() method. This works fine when the service becomes healthy, but when there are issues and it becomes unhealthy, I need to handle this with custom logic. It's possible to throw a FluentDockerException inside the continuation lambda but this causes all services to be disposed before I can handle the FluentDockerException in the try-catch of the ICompositeService.Start() method. Once they are disposed, I can't retrieve the logs using host.Host.ComposeLogs(), therefore making it harder to debug what's going on in a pipeline for example.

This would all not be necessary if the --wait parameter could be passed to the docker-compose up command, which will let Docker Compose handle the health checks, rather than having custom logic.