friends-of-reactphp / mysql

Async MySQL database client for ReactPHP.
MIT License
331 stars 66 forks source link

Improve CI workflow to await database #181

Closed SimonFrings closed 8 months ago

SimonFrings commented 8 months ago

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): image

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