Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce new option to wait until Phiremock is ready #47

Closed
barell opened this issue Apr 8, 2021 · 1 comment
Closed

Introduce new option to wait until Phiremock is ready #47

barell opened this issue Apr 8, 2021 · 1 comment

Comments

@barell
Copy link
Contributor

barell commented Apr 8, 2021

I'm using Phiremock with codeception.

I have acceptance suite and functional suite (they execute in that order). In functional suite, very first test relies on Phiremock response but because Phiremock is shut down after acceptance suite and initialised on functional suite, that very first test fails with curl error (something like failed to connect to 0.0.0.0).

I can fix this issue with start_delay config eg. I can set it to 1 and it will most likely work fine. But the problem is that on my build environment, the machine is a bit slow sometimes and relying on fixed amount of seconds to wait for Phiremock may not always work.

For example, in most cases 1 second delay is fine but sometimes it's not enough. I can set this delay to something like 30 and this will "fix" the issue, but it will make the tests slow. And it may still break if my build env will get slow and that 30 seconds delay will not be enough.

What I want to propose is to introduce a new setting like "wait_until_ready" (true/false) where if set to true, it will check if Phiremock is actually ready to serve requests. This could be done by simply polling Phiremock every second. We could also have another config like "wait_timeout" where you can set some timeout eg. 60 so after 60 seconds it will just stop polling and throw error (to prevent it going indefinitely).

edit

Now I started wondering, why even Phiremock has to shut down after each suite? Is there a way to make it running without shutting down until all tests end?

@barell
Copy link
Contributor Author

barell commented Apr 11, 2021

Hi @mcustiel I saw you added label on this. Any feeback on my PR or this idea in general? I tested it on my project and it worked perfectly.

Thanks

@mcustiel mcustiel closed this as completed May 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants