Ikshi / assignment

0 stars 0 forks source link

Sleep? #3

Open smilinazzo opened 6 months ago

smilinazzo commented 6 months ago

https://github.com/Ikshi/assignment/blob/cdde9f40d9217ba45bb7440288e2cf3fa4e71ae3/.github/workflows/main.yml#L46

I'm curious why we need a sleep in the pipeline. Can you think of any reasons why this might not be best way to determine if the services have started?

Ikshi commented 6 months ago

@smilinazzo I wanted to make sure that the services have started and I’ve used sleep as it’s a simple and quick method to wait for the services instead of writing any timeout configuration/script. It’s not the best method as sleep command doesn’t provide any status of the services, if they are starting or not.

smilinazzo commented 6 months ago

I believe that Docker Compose offers other strategies to detect if a service is up or not. The issue with sleep is that if the services take 31seconds to start and are otherwise fine the tests may fail for not having waited long enough.