GRI-2080: acceptance tests for campus CRUD counts and in-use delete details #216

Closed
astraea wants to merge 3 commits from test/GRI-2080-campus-crud-counts-acceptance-tests into dev
Member

Summary

Acceptance tests for forge issue #213 (campus CRUD counts and in-use delete details, the contract for #207), written before the implementation lands, same convention as #161/#178 and #172/#174.

  • GET /api/v1/campuses gaining device_count/playlist_count per campus, ordered by code.
  • DELETE /api/v1/campuses/{id}'s 409 campus_in_use naming only the non-zero categories in message, with details always carrying all four (media/playlists/devices/ip_rules).
  • Regression anchors for the unchanged parts of the contract: admin-only POST/PATCH/DELETE, 400 on empty code/name, 404 on an unknown id, and GET /campuses still listing every campus for a campus-scoped caller.
  • A guard against the obvious implementation mistake: POST/PATCH must keep returning the bare {id, code, name} row, not leak the two new counts onto it.

Run against dev (71a482f) before this change: 3 of 13 tests fail for the right reason (no details/counts exist yet); the other 10 pass today and anchor behaviour that must not move while #213 is implemented.

$ SIGNAGE_TEST_DATABASE_URL=postgres://postgres:postgres@localhost:5432/postgres?sslmode=disable \
    cargo test -p server --test campus_crud_counts_acceptance_integration
...
failures:
    deleting_a_campus_in_use_message_names_only_the_nonzero_category
    deleting_a_campus_in_use_names_what_still_uses_it
    listing_campuses_includes_device_and_playlist_counts_ordered_by_code

test result: FAILED. 10 passed; 3 failed; 0 ignored; 0 measured; 0 filtered out

Test plan

  • cargo fmt --check -p server
  • cargo clippy -p server --tests
  • ./scripts/local-gates.sh --rust-only (every gate passed)
  • Ran the new suite against unimplemented dev: 3 fail for the right reason, 10 pass as regression anchors.
## Summary Acceptance tests for forge issue #213 (campus CRUD counts and in-use delete details, the contract for #207), written before the implementation lands, same convention as #161/#178 and #172/#174. - `GET /api/v1/campuses` gaining `device_count`/`playlist_count` per campus, ordered by `code`. - `DELETE /api/v1/campuses/{id}`'s `409 campus_in_use` naming only the non-zero categories in `message`, with `details` always carrying all four (`media`/`playlists`/`devices`/`ip_rules`). - Regression anchors for the unchanged parts of the contract: admin-only `POST`/`PATCH`/`DELETE`, `400` on empty `code`/`name`, `404` on an unknown id, and `GET /campuses` still listing every campus for a campus-scoped caller. - A guard against the obvious implementation mistake: `POST`/`PATCH` must keep returning the bare `{id, code, name}` row, not leak the two new counts onto it. Run against `dev` (`71a482f`) before this change: 3 of 13 tests fail for the right reason (no `details`/counts exist yet); the other 10 pass today and anchor behaviour that must not move while #213 is implemented. ``` $ SIGNAGE_TEST_DATABASE_URL=postgres://postgres:postgres@localhost:5432/postgres?sslmode=disable \ cargo test -p server --test campus_crud_counts_acceptance_integration ... failures: deleting_a_campus_in_use_message_names_only_the_nonzero_category deleting_a_campus_in_use_names_what_still_uses_it listing_campuses_includes_device_and_playlist_counts_ordered_by_code test result: FAILED. 10 passed; 3 failed; 0 ignored; 0 measured; 0 filtered out ``` ## Test plan - [x] `cargo fmt --check -p server` - [x] `cargo clippy -p server --tests` - [x] `./scripts/local-gates.sh --rust-only` (every gate passed) - [x] Ran the new suite against unimplemented `dev`: 3 fail for the right reason, 10 pass as regression anchors.
GRI-2080: acceptance tests for campus CRUD counts and in-use delete details
Some checks failed
CI / the pre-push hook (pull_request) Successful in 27s
CI / cargo fmt (pull_request) Successful in 26s
CI / cargo clippy (pull_request) Successful in 2m16s
CI / cargo deny (pull_request) Successful in 1m55s
CI / cargo test (pull_request) Failing after 2m54s
CI / repository boundary (pull_request) Successful in 46s
CI / cargo deny advisories (pull_request) Successful in 2m12s
CI / frontend-web (pull_request) Successful in 1m48s
CI / CI (pull_request) Failing after 59s
CI / Notify gate failed (pull_request) Successful in 1m3s
b0cf7dd331
Merge origin/dev into test/GRI-2080-campus-crud-counts-acceptance-tests
Some checks failed
CI / the pre-push hook (pull_request) Successful in 33s
CI / cargo fmt (pull_request) Successful in 53s
CI / cargo clippy (pull_request) Successful in 2m20s
CI / cargo deny advisories (pull_request) Successful in 2m41s
CI / cargo deny (pull_request) Successful in 2m50s
CI / repository boundary (pull_request) Successful in 45s
CI / cargo test (pull_request) Failing after 3m40s
CI / frontend-web (pull_request) Successful in 2m27s
CI / CI (pull_request) Failing after 51s
CI / Notify gate failed (pull_request) Successful in 48s
91744c9322
Merge origin/dev into test/GRI-2080-campus-crud-counts-acceptance-tests
Some checks failed
CI / the pre-push hook (pull_request) Successful in 1m6s
CI / cargo fmt (pull_request) Successful in 1m27s
CI / cargo clippy (pull_request) Successful in 2m48s
CI / cargo deny (pull_request) Successful in 2m25s
CI / cargo deny advisories (pull_request) Successful in 2m17s
CI / cargo test (pull_request) Failing after 3m36s
CI / repository boundary (pull_request) Successful in 57s
CI / frontend-web (pull_request) Successful in 2m26s
CI / Notify gate failed (pull_request) Successful in 31s
CI / CI (pull_request) Failing after 34s
0e32c9057f
Merge remote-tracking branch 'origin/dev' into test/GRI-2080-campus-crud-counts-acceptance-tests
Some checks failed
CI / the pre-push hook (pull_request) Successful in 50s
CI / cargo fmt (pull_request) Successful in 1m0s
CI / cargo clippy (pull_request) Successful in 2m24s
CI / cargo deny (pull_request) Successful in 2m35s
CI / cargo deny advisories (pull_request) Successful in 2m44s
CI / frontend-web (pull_request) Failing after 1m35s
CI / repository boundary (pull_request) Successful in 51s
CI / cargo test (pull_request) Successful in 4m40s
CI / Notify gate failed (pull_request) Successful in 16s
CI / CI (pull_request) Failing after 17s
6622fd815c
Owner

Closing without merge: the diff is empty. The test commit b0cf7dd (GRI-2080) is already in dev, carried by PR #219 (GRI-2075). fj landed GRI-2080 = 0. The red frontend-web here is on a base 10 commits behind dev; dev tip is green.

Closing without merge: the diff is empty. The test commit b0cf7dd (GRI-2080) is already in dev, carried by PR #219 (GRI-2075). `fj landed GRI-2080` = 0. The red frontend-web here is on a base 10 commits behind dev; dev tip is green.
vivy closed this pull request 2026-11-15 15:21:10 +00:00
Some checks failed
CI / the pre-push hook (pull_request) Successful in 50s
CI / cargo fmt (pull_request) Successful in 1m0s
Required
Details
CI / cargo clippy (pull_request) Successful in 2m24s
Required
Details
CI / cargo deny (pull_request) Successful in 2m35s
Required
Details
CI / cargo deny advisories (pull_request) Successful in 2m44s
Required
Details
CI / frontend-web (pull_request) Failing after 1m35s
Required
Details
CI / repository boundary (pull_request) Successful in 51s
Required
Details
CI / cargo test (pull_request) Successful in 4m40s
Required
Details
CI / Notify gate failed (pull_request) Successful in 16s
CI / CI (pull_request) Failing after 17s

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Grimoirix/grimoire-of-digital-signage!216
No description provided.