Improve CI workflow to await database #181
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We recently encountered failing test runs in our CI matrix with an error response like this (nearly all tests failed with this same error response):

These failures occurred only occasionally, indicating some kind of race condition. A while ago, we introduced the
wait-for-mysql.sh
file in pull request #132. This file waits for the internal database to be ready to handle SQL queries before running our PHPUnit tests. However, while this file waited for the internal part of Docker to be ready, the external port was always opened just moments after the database became ready to handle SQL queries. As a result, our test suite failed because the tests couldn't establish a connection to the database.This pull request now fixes this issue by explicitly using the
--host
&--port
configuration option. I tested this in my fork by running the test suite multiple times without encountering any failures.Builds on top of #132 and others