Repository navigation
fix(testing): honor allowTestsAgainstPrimaryDatasource when useTestDB is omitted - #4648
Merged
Merged
Conversation
… useTestDB #4643: $testDataSourceDecision() returned "swap" as soon as <primary>_test was registered, before consulting allowTestsAgainstPrimaryDatasource, so the documented 4.2 behavior was unreachable whenever a test datasource existed. For an omitted useTestDB the opt-out is checked first and runs on the primary datasource with a warning; explicit useTestDB=true still requires the test datasource and explicit useTestDB=false still targets the primary. The framework's own suite passes ignoreAllowPrimary, so it keeps using <primary>_test and still refuses when it is missing. #4642: the DebugBar Test Suite panel's "Open full runner" link and in-page JSON runner URL now include useTestDB=false when the app allows tests against the primary datasource, so the same decision applies there; otherwise both URLs are unchanged. Regression specs cover the omitted/true/false x allowPrimary x candidate combinations and render the debug bar to assert both URLs. Signed-off-by: Peter Amiri <peter@alurium.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
Fixes #4643 and #4642. Both come from the same rule: an app test run that omits
useTestDBshould followset(allowTestsAgainstPrimaryDatasource=true)instead of silently swapping to<datasource>_test.$testDataSourceDecision()(vendor/wheels/global/util.cfm): the registeredcandidateRegisteredcheck returned"swap"before theallowPrimaryblock, so the documented 4.2 behavior was unreachable whenever a<datasource>_testexisted. For an omitteduseTestDB, the opt-out is now checked first:primary+warn=trueeven when the test datasource is registered. ExplicituseTestDB=truestill requires the test datasource (refused when missing); explicituseTestDB=falsestill targets the primary; a present-but-invalid value is still treated as not-omitted.vendor/wheels/events/onrequestend/debug.cfm): both the "Open full runner" link and the in-page JSON runner URL are now built from the same setting — they appenduseTestDB=falsewhen the app allows primary-datasource tests, and stay byte-for-byte as before when it does not.$coreTestDataSource()now passesignoreAllowPrimaryto the decision, so the framework's own runner keeps its rule (use<primary>_testwhen registered, refuse when missing) and still logs the "ignores allowTestsAgainstPrimaryDatasource" warning. This was caught by the existingCoreTestRunnerDataSourceSpec— without the opt-out, a registered test datasource made the core runner refuse.No public API change (
$-prefixed internal helpers only).Behaviour matrix (
$testDataSourceDecision)useTestDBtruetruefalse"maybe")"maybe")Regression specs
dispatch/ProjectTestRunnerDataSourceSpec.cfc— 7 new cases covering omitted/true/false× allowPrimary on/off × candidate registered/not (including the non-boolean value). The omitted + allowPrimary + registered case fails on the parent commit (Expected [primary] but received [swap]) and passes with the fix.events/DebugBarTestRunnerUrlSpec.cfc(new) — rendersdebug.cfmthrough$includeAndReturnOutput()with the same request mock the other DebugBar specs use, and asserts thehrefandwindow.wdbTests.runUrlstrings: both carryuseTestDB=falsewhen the setting is on; neither carries it when off. Fails on the parent commit (href="/wheels/app/tests"without the flag) and passes with the fix. There is a test seam for this panel, so no manual curl was needed to cover it.Failing-then-passing with both production diffs stashed: decision spec 1 failed, DebugBar spec 1 failed; with the fix both green.
Tests
bash tools/test-local.sh(full core suite) → 7357 passedtools/test-matrix.sh lucee7 sqlite+lucee6,adobe2023,boxlang sqliteand RustCFML run: results appended below before review.Changelog
changelog.d/4642-4643-tests-primary-datasource.fixed.md.Fixes #4642
Fixes #4643