Files
zitadel/tests/functional-ui/project.json
T
94f53145da chore(ci): let nx stop continuous run-db tasks instead of compose down from within the test targets (#12663)
# Which Problems Are Solved

CI runs have been flaky since ~Aug 27 with the nx step failing on

```
Task "@zitadel/api:test-integration-run-db" is continuous but exited with code 0
Task "@zitadel/functional-ui:run-db" is continuous but exited with code 0
```

even when every test passed, and with the sibling test suite killed
mid-run (`Process completed with exit code 130`).

Root cause: the test targets shoot their own database.
`@zitadel/api:test-integration` and `@zitadel/functional-ui:test` end
their command list with an explicit `nx run ...:stop` (`compose down`)
of the very service their **continuous** `run-db` dependency (`compose
up`) is supervising. The `run-db` task then exits on its own, which nx
(22.x) counts as a **failed task**:

1. the nx run is marked failed even with all tests green, and
2. with `--nxBail`, the other suite that is still running is aborted
mid-flight.

Whichever suite finishes first triggers it, so the failure is
timing-dependent and flaky. Recent examples: [attempt 1 of this
run](https://github.com/zitadel/zitadel/actions/runs/33161619698/attempts/1)
(all 42 integration packages + all Cypress specs green, job still
failed) and [this
run](https://github.com/zitadel/zitadel/actions/runs/33166856821)
(Cypress finished first, integration tests killed at 4m13s).

# How the Problems Are Solved

Drop the trailing `nx run ...:stop` commands from the two test targets.
nx stops continuous dependencies itself once all their dependents
finish, so the self-inflicted exit never happens. The `stop` targets
remain unchanged for manual use as documented in CONTRIBUTING.md.

Since this PR touches both projects' configuration, both test suites run
on this PR — a green pipeline here exercises exactly the raced path.

# Additional Context

- The race existed since the nx 22 upgrade (#12592) but only started
losing consistently around Aug 27, presumably due to changed teardown
timing on the updated Depot runner images (same window as the
`*.integration.localhost` DNS breakage worked around in #12621).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Fable 5 <[email protected]>
2026-08-28 15:53:57 +02:00

46 lines
1.9 KiB
JSON

{
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"implicitDependencies": ["@zitadel/api", "@zitadel/console"],
"targets": {
"run-db": {
"continuous": true,
"description": "Runs a local ephemeral Postgres database for functional UI (Console) tests.",
"command": "nx run @zitadel/devcontainer:compose up --force-recreate --renew-anon-volumes db-functional-ui"
},
"run-api": {
"description": "Sets up and runs the Zitadel API with the embedded Management Console against which the functional UI tests are run.",
"continuous": true,
"dependsOn": ["@zitadel/api:build"],
"executor": "nx:run-commands",
"options": {
"command": "nx run @zitadel/api:prod:test-functional-ui --excludeTaskDependencies"
}
},
"open": {
"description": "Opens the Cypress Test Runner for interactive testing.",
"continuous": true,
"dependsOn": ["@zitadel/console:dev", "run-db", "run-api"]
},
"test": {
"description": "Runs the functional UI (Console) tests against a Zitadel API and a specified browser. Pass an installed browser as an argument, like --browser electron. The 'electron' browser should always be available.",
"dependsOn": ["run-db", "run-api", "@zitadel/api:build"],
"executor": "nx:run-commands",
"options": {
"parallel": false,
"cwd": "{projectRoot}",
"commands": [
"cypress install",
"wait-on --verbose --interval 2000 --simultaneous 1 --timeout 30m \"${CYPRESS_BACKEND_URL}/debug/ready\"",
"DISPLAY='' cypress run"
]
},
"cache": true,
"inputs": ["default", { "dependentTasksOutputFiles": ".artifacts/bin/*/*/zitadel.local" }]
},
"stop": {
"description": "Stops the local Postgres database used for functional UI (Console) tests.",
"command": "nx run @zitadel/devcontainer:compose down --volumes db-functional-ui"
}
}
}