Fix integration test DB hostname resolution in CI - #55
Merged
Conversation
Integration tests were failing on every matrix leg with 'getaddrinfo for mysql failed' — the test/mutation-test jobs run directly on the runner VM (no container:), so the DB is only reachable via 127.0.0.1 + the mapped port, not the container name 'mysql' that phpunit.xml.dist defaults to for local Docker Compose dev. Depends on php-db/phpdb-qa-tools#5 (adds the test-env-json input this relies on) — CI on this PR will error referencing an undefined input until that merges.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
Adds
test-env-json: '{"TESTS_PHPDB_ADAPTER_MYSQL_HOSTNAME":"127.0.0.1"}'to the caller workflow.Why
Integration tests are failing on every matrix leg in the current CI run (#53/#54) with
getaddrinfo for mysql failed: Temporary failure in name resolution. Root cause: thetest/mutation-testjobs in the shared workflow run directly on the runner VM (nocontainer:key), so the DB started via the manualdocker runstep is only reachable via127.0.0.1+ the mapped port, not the container name — confirmed by GitHub's own docs on service containers.phpunit.xml.distdefaultsTESTS_PHPDB_ADAPTER_MYSQL_HOSTNAMEtomysqlfor local Docker Compose dev, where the PHP and MySQL containers share a Compose network (container-to-container, that's a different scenario). Overriding the real env var in CI takes precedence overphpunit.xml.dist's non-forced<env>default — confirmed via PHPUnit's own docs — without touching that file or affecting local dev.That PR adds the
test-env-jsoninput this relies on. CI on this PR will fail with "Invalid input, test-env-json is not defined in the referenced workflow" until #5 merges — expected, not a new problem.