Skip to content

Add test-env-json input (follow-up to #5, missed in that merge) - #6

Merged
tyrsson merged 1 commit into
0.1.xfrom
test-env-json-followup
Aug 10, 2026
Merged

Add test-env-json input (follow-up to #5, missed in that merge)#6
tyrsson merged 1 commit into
0.1.xfrom
test-env-json-followup

Conversation

@tyrsson

Copy link
Copy Markdown
Member

What

Adds test-env-json input (JSON object) exported via $GITHUB_ENV before running tests in both test and mutation-test. Lets a caller override a phpunit.xml.dist connection setting for CI (e.g. a DB hostname that needs to differ between local Docker Compose networking and CI's non-containerized job) without editing that file.

Why

Found via phpdb-mysql's first real CI run: integration tests failed on every leg with getaddrinfo for mysql failed: Temporary failure in name resolution. Root cause: the test/mutation-test jobs run directly on the runner VM (no container: key), so the DB started by the manual docker run step is only reachable via 127.0.0.1 + the mapped port, not the container name — confirmed by GitHub's own docs on service containers. phpdb-mysql's phpunit.xml.dist defaults TESTS_PHPDB_ADAPTER_MYSQL_HOSTNAME to mysql for local Docker Compose dev (container-to-container, works fine there). Also confirmed via PHPUnit's docs: <env> does not override an already-set real env var unless force="true", so setting the real env var in CI via test-env-json correctly takes precedence without needing force (which would break local dev).

Note

This commit was originally pushed onto the infection-msi-threshold branch after#5 had already been merged, so it never actually made it into 0.1.x despite being included in that PR's description. Re-opening it here as its own PR to get it in. php-db/phpdb-mysql#55 depends on this.

…tings for CI
Confirmed via PHPUnit's docs: <env> in phpunit.xml.dist does not override
an already-set real env var unless force="true". This lets a caller
override a connection setting (e.g. DB hostname, which needs to differ
between local Docker Compose networking and CI's non-containerized job)
without editing phpunit.xml.dist or forcing an override that would break
local dev.
Root cause found via phpdb-mysql's first real CI run: integration tests
failed everywhere with 'getaddrinfo for mysql failed' because the test
job isn't containerized (runs directly on the runner VM), so the DB
started by the manual docker run step is only reachable via 127.0.0.1 and
the mapped port, not the container name.
@tyrssontyrsson self-assigned this Aug 10, 2026
@tyrssontyrsson added bug Something isn't working enhancement New feature or request labels Aug 10, 2026
@tyrsson
tyrsson merged commit f232342 into 0.1.xAug 10, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugSomething isn't workingenhancementNew feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@tyrsson