fix(tests): resolve Newman fixture paths and honour the CI base_url variable - #232
Open
rubenvdlinde wants to merge 1 commit into
Open
fix(tests): resolve Newman fixture paths and honour the CI base_url variable#232rubenvdlinde wants to merge 1 commit into
rubenvdlinde wants to merge 1 commit into
Conversation
…ariable
Two defects in the integration suite, both invisible from the collection
itself, cost 14 assertions on `development`.
1. Multipart fixture paths were repo-root-relative
(`tests/integration/fixtures/*`). Newman resolves a formdata `src` against
`--working-dir`, which defaults to the process CWD. The shared CI workflow
(ConductionNL/.github .github/workflows/quality.yml, job `newman`) does
`cd server/apps/<app>/<newman-collection-path>` and invokes newman with no
`--working-dir`, so those paths could never resolve in CI. Newman then sent
each upload WITHOUT its file part and the app correctly answered
`400 No file uploaded.` — which surfaced as "custom token set upload is
broken" across all 14 assertions in folder 4 (upload 400, collision 400
instead of 409, selector/JSON validation 400 instead of 422, empty list,
export 404, delete 400). The app was never at fault. Paths are now relative
to the collection file, which is CWD in CI, and run-newman.sh pins
`--working-dir` to the same directory.
2. CI passes `base_url` / `admin_user` / `admin_password`; the requests use
`{{baseUrl}}` / `{{adminUser}}` / `{{adminPass}}`. Nothing mapped one onto
the other, so all three flags were inert and the suite fell back to its
defaults. Measured: with `--env-var base_url=http://localhost:8199` the old
collection still sent every request to localhost:8080. Today the defaults
happen to equal what CI passes, so it looked fine — but a run could target a
completely different instance and still report on it. A collection-level
prerequest script now aliases the three names and derives `noAuthBase` from
the effective base URL, keeping the authz host-split intact. Environment
scope still outranks collection scope, so an explicit `--env-var baseUrl=`
(what run-newman.sh passes) continues to win.
No test was skipped, disabled or relaxed, and no application code changed.
Verified on a disposable pgsql-backed Nextcloud with openregister + nldesign
enabled, running newman exactly as CI does (cwd = collection dir, snake_case
env vars, no --working-dir): 46 requests / 108 assertions / 14 failed before,
0 failed after.
Failure proofs (each fix shown able to go red):
- Hiding fixtures/newman-valid.css returns 12 of the 14 failures.
- Changing the disallowed-selector status from 422 to 418 in
CustomTokenSetController turns exactly one assertion red; newman logs the 418.
- With base_url pointed at a dead port, the old collection stays on :8080 while
the fixed one follows it and fails loudly.
Contributor
Quality Report — ConductionNL/nldesign @
|
| Check | PHP | Vue | Security | License | Tests |
|---|---|---|---|---|---|
| lint | ✅ | ||||
| phpcs | ✅ | ||||
| phpmd | ✅ | ||||
| psalm | ✅ | ||||
| phpstan | ✅ | ||||
| phpmetrics | ✅ | ||||
| eslint | ✅ | ||||
| stylelint | ✅ | ||||
| build | ✅ | ||||
| check-manifest | ✅ | ||||
| test-l10n | ✅ | ||||
| composer | ✅ | ✅ 100/100 | |||
| npm | ✅ | ✅ 2/2 | |||
| PHPUnit | ✅ | ||||
| Newman | ✅ | ||||
| Playwright | ✅ | ||||
| Hydra gates | ❌ |
Quality workflow — 2026-08-06 06:40 UTC
Download the full PDF report from the workflow artifacts.
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
Clears all 14 Newman failures on
development. No test was skipped, disabled or relaxed, and no application code changed — both defects were in the test harness.Root causes (one cluster, two defects)
1. Multipart fixture paths could never resolve in CI — classification (c) fixture/seed wrong
The upload requests carried
"src": "tests/integration/fixtures/*". Newman resolves a formdatasrcagainst--working-dir, which defaults to the process CWD. The shared workflow (ConductionNL/.github→.github/workflows/quality.yml, jobnewman) doescd server/apps/<app>/<newman-collection-path>and then invokes newman with no--working-dir— so CWD is the collection directory and a repo-root-relative path resolves to nothing.Newman does not fail on an unresolvable file part; it sends the request without it. The app then correctly answers
400 No file uploaded.This is why all 14 failures presented as "custom token set upload is broken":This only ever worked locally because
run-newman.shpassed the repo root as--working-dir; CI never did.Fix: paths are relative to the collection file (which is CWD in CI), and
run-newman.shpins--working-dirto the same directory so both agree.2. CI's
base_url/admin_user/admin_passwordwere inert — classification (b) collection wrongCI passes those three snake_case variables; the requests use
{{baseUrl}}/{{adminUser}}/{{adminPass}}. Nothing mapped one onto the other, so all three flags did nothing and the suite silently fell back to its collection defaults.Measured directly: with
--env-var base_url=http://localhost:8199, the old collection still sent every single request tolocalhost:8080. Today the defaults happen to equal what CI passes, so it looked fine — but a run could target a completely different instance and report on it as if it were the one under test. (This bit during investigation: an early measurement silently hit the shared dev instance instead of the disposable replica.)Fix: a collection-level
prerequestscript aliases the three names and derivesnoAuthBasefrom the effective base URL so the authz host-split stays intact. Environment scope still outranks collection scope, so an explicit--env-var baseUrl=(whatrun-newman.shpasses) continues to win.Five numbers
Measured on a disposable pgsql-backed Nextcloud with
openregister+nldesignenabled, invoking newman exactly as CI does (cwd = collection dir, snake_case env vars, no--working-dir):Exit code
0. Identical result via the shippedrun-newman.sh. This reproduces CI run31045984082/ job92442612396exactly (same 14 assertions, same order).Failure proofs
Every fix was shown able to go red:
fixtures/newman-valid.css: 12 of the 14 failures return (the other 2 use the bad-selector and malformed-JSON fixtures, still present). Restored → green.422to418inCustomTokenSetController. Confirmed live with a directcurl(STATUS=418) before trusting the run; newman then reported exactly 1 failure and logged[418 I'm a teapot]. Reverted → green.base_urlpointed at a dead port8199, the old collection still hit:8080and reported its usual 14; the fixed collection follows to:8199and fails loudly (50 failed). Proves the variable now actually takes effect.Also fixed (pre-existing)
README-newman.mdclaimed "23 requests / 50 assertions" and documented no folder 4 — stale since the custom-token-set family landed. Corrected to 46/108 with the family documented, plus both conventions written down so they cannot drift back.