Repository navigation
Fix phpunit SIMPLETEST_BASE_URL / D12 core-tests failures in drupal-core and drupal-contrib - #215
Merged
Merged
Conversation
drupal-core always omits ddev-router, so DDEV never populates
DDEV_PRIMARY_URL. amateescu/ddev-drupal-dev's own config.drupal-dev.yaml
sets SIMPLETEST_BASE_URL=${DDEV_PRIMARY_URL}, which is therefore always
empty, failing every phpunit functional/JS test with "You must provide
a SIMPLETEST_BASE_URL environment variable". Reproduced live on a
staging workspace, including the exact
SettingSummariesContentTypeTest::testWorkflowSummary test from the
issue report.
Override SIMPLETEST_BASE_URL to the web container's own Docker-network
hostname (http://web), which is reachable regardless of routing, via a
config.zzz-coder-test-env.yaml file named to sort after the add-on's
own config file so it wins. Also point BROWSERTEST_OUTPUT_BASE_URL at
the real Coder proxy URL instead of the container-only http://web, so
failed-test debug links are actually clickable from outside.
drupal-contrib is unaffected: its ddev-drupal-contrib add-on already
hardcodes SIMPLETEST_BASE_URL=http://web rather than relying on
DDEV_PRIMARY_URL.
Add a phpunit smoke-test step to both drupal-integration-test.yml and
drupal-contrib-integration-test.yml's GH-runner jobs so this class of
regression is caught in CI going forward.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
…#216 The new phpunit CI step added earlier in this branch failed on the "Contrib skipto D12 (plain, GH)" cell with "Cannot open bootstrap script core/tests/bootstrap.php": https://github.com/ddev/coder-ddev/actions/runs/36280470996/job/108511195288 drupal_version=12 has no stable tag yet, so it resolves to the 12.x-dev branch (see #212). Composer's default dist install for a -dev/branch version fetches a GitHub zipball, which is a git-archive snapshot honoring drupal/core's own .gitattributes export-ignore rules -- and those strip core/tests entirely. D10/D11 are unaffected since they resolve to real tagged releases, whose dist packages aren't built this way. Verified: a plain `git clone` of the same ref includes tests/, and forcing `composer config preferred-install.drupal/core source` (so Composer does a real clone instead of downloading the zipball) fixes it end-to-end -- confirmed core/tests present and the CI smoke test (`ddev phpunit web/core/modules/system/tests/src/Functional/System/PageTitleTest.php`) passing on a fresh workspace. Set that config only for drupal_version=12, before `ddev poser` runs; D10/D11 are untouched since forcing source there would only slow down every install for no benefit. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Confirmed with the user: D12 is already meant to track HEAD of drupal/core's main branch, matching how people actually work on D12 issues locally. The "12.x-dev" constraint achieves this indirectly -- it's not a branch name but the version composer's branch-alias maps main onto -- which was non-obvious enough to be worth spelling out. No behavior change. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
Summary
drupal-corealways omitsddev-router, so DDEV never populatesDDEV_PRIMARY_URL.amateescu/ddev-drupal-dev's ownconfig.drupal-dev.yamlsetsSIMPLETEST_BASE_URL=${DDEV_PRIMARY_URL}, which is therefore always empty, failing every phpunit functional/JS test with "You must provide a SIMPLETEST_BASE_URL environment variable". Root-caused and reproduced live on staging, including the exactSettingSummariesContentTypeTest::testWorkflowSummarytest from the issue.SIMPLETEST_BASE_URLto the web container's own Docker-network hostname (http://web), reachable regardless of routing, via a.ddev/config.zzz-coder-test-env.yamlfile named to sort alphabetically after the add-on's own config file so it wins.BROWSERTEST_OUTPUT_BASE_URLat the real Coder proxy URL instead of the container-onlyhttp://web, so failed-test debug links are actually clickable from outside the container.drupal-contribwas not affected — its add-on already hardcodesSIMPLETEST_BASE_URL=http://web. No fix needed there, but added CI coverage anyway (see below) since it's the same regression class.drupal-integration-test.ymlanddrupal-contrib-integration-test.yml's GH-runner jobs so this doesn't silently regress again.drupal-core/drupal-contribto the router-based Host-header dispatchfreeformalready uses, which avoids this whole class of bug rather than patching around it.drupal-contribCI step above caught a second, unrelated bug: theContrib skipto D12 (plain, GH)cell failed CI withCannot open bootstrap script core/tests/bootstrap.php. Root cause:drupal_version=12installsdrupal/corefrom the12.x-devbranch (no stable D12 tag exists yet), and Composer's default dist install for a-devversion fetches a GitHub zipball — agit archivesnapshot that honorsdrupal/core's own.gitattributes export-ignorerules, which stripcore/testsentirely. D10/D11 are unaffected since they resolve to real tagged releases packaged differently. Fixed by forcingcomposer config preferred-install.drupal/core source(a realgit clone, which doesn't applyexport-ignore) fordrupal_version=12only. Verified end-to-end on a fresh workspace (see manual testing below). Filed drupal-contrib D12: core/tests missing because dev-branch dist zip strips it via .gitattributes export-ignore #216 for traceability.Manual testing instructions
These were run against staging-coder.ddev.com before opening this PR; repeating them here for review/reproduction.
drupal-core
ssh verify-core.coder 'tail -f /tmp/drupal-setup.log'until you see the admin credentials block.SIMPLETEST_BASE_URL=http://webandBROWSERTEST_OUTPUT_BASE_URL=https://drupal-site--verify-core--<you>.<coder-domain>.OK.OK.coder delete verify-core --yes && coder templates versions archive drupal-core pr-verify-core --yes.drupal-contrib (regression check — should already pass, confirming CI coverage doesn't break it)
drupal-contribtemplate (unchanged by this PR, but push it fresh so CI's new step is exercised against the current code):pathauto):ssh verify-contrib.coder 'tail -f /tmp/drupal-setup.log'until it finishes.SIMPLETEST_BASE_URLis already correct (no change expected here):SIMPLETEST_BASE_URL=http://web.OK.OK.coder delete verify-contrib --yes && coder templates versions archive drupal-contrib pr-verify-contrib --yes.drupal-contrib D12 (the actual regression this PR fixes — #216)
pr-verify-contribtemplate version, this time forskiptoon D12 (the exact cell that failed CI):ssh verify-contrib-d12.coder 'tail -f /tmp/drupal-setup.log'until it finishes.core/testsis present (previously missing before this fix):EXISTS.OK.coder delete verify-contrib-d12 --yes.Test plan
terraform fmt -recursivecleanmake validatepasses for all templatesmake test-templatespasses for all templatesdrupal-integration-test.ymlanddrupal-contrib-integration-test.ymlwill exercise this automatically going forward🤖 Generated with Claude Code