Skip to content

test: CLARIN consumer-contract suite + main-tailored differential CI - #23

Open
jr-rk wants to merge 2 commits into
dtqfrom
test/clarin-usage-coverage
Open

jr-rk wants to merge 2 commits into
dtqfrom
test/clarin-usage-coverage

Conversation

@jr-rk

@jr-rk jr-rk commented Aug 20, 2026

Copy link
Copy Markdown

Purpose

Testing infrastructure only. Adds CI + characterization tests tailor-made for
main's usage surface — how the three main-lineage consumers
(dspace-import-clarin, dspace-rest-test, dspace-item-importer) actually
call this library. No dspace_rest_client/ changes. Targets dtq and
proposes nothing for main.

Shared-surface fixes the tests would otherwise pin are split into a stacked PR
(fix/clarin-shared-surface-hardening) so this one stays scoped to test/CI.

What's here

  • CLARIN counterpart to test_repo_usage_contract.py: per-method and
    whole-chain characterization tests, only the HTTP transport mocked (the real
    client builds URLs and parses responses).
  • _helpers.py CLARIN builders, pytest.ini markers, requirements-test.txt.
  • .github/workflows/tests.yml: branch-aware triggers plus a
    differential-contract job that runs the shared CLARIN contract against
    both the dtq and the main implementation. The main leg checks
    origin/main's client into the CI runner to test against it — read-only,
    nothing is written back to main. A contract green on both is what a future
    merge would need to preserve.

Markers

  • clarin — shared contract, must hold on both main and dtq.
  • dtq_only — existing dtq-only surface/behaviour, deselected on the main leg.

Verified locally

  • Leg A (full suite, dtq impl): 123 pass.
  • Leg B (shared contract, main impl): 44 pass, 3 dtq_only deselected.

jr-rk and others added 2 commits October 7, 2026 09:18
Add characterization tests that replay how the three main-lineage consumers
(dspace-import-clarin, dspace-rest-test, dspace-item-importer) actually call
this library, plus a branch-differential CI job that runs the shared CLARIN
contract against BOTH the dtq and main implementations. Only the HTTP
transport is mocked; the real client builds URLs and parses responses.

This PR is test + CI infrastructure only - no dspace_rest_client/ changes.
The shared-surface fixes and dtq behaviour deltas that the tests would
otherwise pin live in a separate, stacked PR, so this one stays scoped to
validating main's usage surface and proposes nothing for main.

Markers (pytest.ini):
  clarin    - shared contract, must hold on both main and dtq
  dtq_only  - existing dtq-only surface/behaviour, deselected on the main leg

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…uri-list body, no persisted consumer token

- remove_metadata(None, ...) test asserted it returns the client itself,
  pinning a bug a sibling fix changes to None. Assert only the contract:
  no request is sent and no DSO is returned.
- add_member: assert the text/uri-list body - one absolute URI under the
  API ending in /epersons/{uuid}. DSpace resolves only the trailing UUID,
  so this is shared contract, not dtq_only.
- consumer-smoke: checkout of the private consumer repo sets
  persist-credentials: false, since the job then runs PR code.
@vidiecan
vidiecan force-pushed the test/clarin-usage-coverage branch from 0c7411b to 13ba16c Compare October 7, 2026 07:26
@vidiecan

vidiecan commented Oct 7, 2026

Copy link
Copy Markdown

Rebased onto dtq a62a63e + review fixes

New head: 13ba16c (rebased commit 13d0243 + one review commit). Note: #22 shares this head branch, so it moved too.

Conflict resolution

Review fixes (tests/CI only)

Finding Change Test
test_invalid_dso_returns_self_without_request pinned a bug (remove_metadata(None, ...) returning the client); #25 changes it to None, so whichever landed second would go red Renamed to test_invalid_dso_sends_no_request_and_returns_no_dso: asserts no request is sent and the result is not a DSpaceObject - holds for both self and None passes on dtq and main legs
add_member body was never asserted New shared (clarin, not dtq_only) test_posts_eperson_uri_list_and_returns_true_on_204: text/uri-list, exactly one absolute URI under the API ending in /epersons/{uuid}. DSpace resolves only the trailing UUID, so both /epersons/{uuid} (main/dtq today) and the canonical /eperson/epersons/{uuid} (#24) satisfy it passes on dtq and main legs
consumer-smoke checked out private consumer repos with CONSUMER_READ_TOKEN and default persist-credentials, then ran PR code persist-credentials: false on that checkout workflow change

Verified locally

  • Full suite + --cov-fail-under=70: 143 passed, 72% coverage.
  • Differential contract: dtq leg 48 passed; main leg 45 passed, 3 dtq_only deselected.
  • Python 3.8.20: 143 passed.

Deferred (not changed here)

  • Chain tests in test_clarin_usage_contract.py are not truly chained (some feed hand-built objects instead of the previous call's result, eg. create_submit_group(type("C", (), {...})())).
  • Some per-method tests duplicate the chain tests (eg. the bundle-by-name lookups).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants