Skip to content

Smoke tests: verify bundled imports and endpoint behaviour against a real database #328

Open

Description

@DutchJaFO

Background

Two core guarantees are only meaningful against a live database, so unit tests cannot establish them,
and neither is currently covered as a feature in its own right.

Bundled imports should result in a clean import. A section exists covering per-source
conflict-resolution rule files, but it is framed around one issue's rule files rather than the general
guarantee that a fresh install seeds the bundled content with nothing left needing review.

Endpoints need exercising against an actual database. The endpoint tests replace IQuoteService
with FakeQuoteService and IDatabaseInitializer with NoOpDatabaseInitializer by design, so they
deliberately never touch SQL. That is the right call for those tests, but it means no test proves the
endpoints behave correctly against real data. This gap has bitten before: readers translating
pageSize = 0 into LIMIT 0 instead of LIMIT -1 passed every endpoint test because the stubs echoed
their input back, and were only caught by a live pass.

#339 restructures the suite into docs/automated-testing/ first. This issue authors its sections as
documents in that structure rather than as sections of the removed monolith.

What needs to be done

  1. A test verifying that a fresh container seeds every bundled source and finishes with zero pending
    import actions
    — the clean-import guarantee stated as its own check, independent of any one issue's
    rule files.
  2. That test asserts bundled entity counts are all non-zero and that no import action remains in a state
    needing review.
  3. A test exercising the read endpoints against the real seeded database — the paginated list endpoints,
    their GET /{id} counterparts, and the masterdata endpoints — asserting real returned data, not just
    status codes.
  4. Endpoint coverage targets what neither a stub-backed endpoint test nor an existing repository-level
    test
    already proves. The pageSize = 0 class is not that:
    SqliteRepositoryTests.GetPageAsync_PageSizeZero_ReturnsEveryRowAsOnePage already covers the generic
    repository every masterdata endpoint uses, and AuditEntryReaderTests, ImportActionWriterReaderTests,
    NotificationReaderTests, SqliteFileResourceRepositoryTests and SqliteQuoteServiceTests cover the
    hand-written readers. What the live tier adds is the whole path end to end against the real bundled
    dataset
    — real row counts, real reference resolution, real translations — which no test with a
    constructed fixture reaches. Each case states which of those it proves.
  5. Both tests are independent of every other test and of each other: each creates, seeds, and destroys
    its own container and volume.
  6. Neither asserts a specific migration number or schema version.
  7. Each document carries Restructure the T2 suite into docs/automated-testing/, one document per test #339's template fields, including Determinism and its smoke-set designation.
    The proposed designation goes in the plan doc for approval — the clean-import check is a strong smoke
    candidate, since a fresh container failing to seed cleanly invalidates most other tests.
  8. Where either test needs fixture files or expected-output samples, they go in a subfolder beside the
    document; any script goes to scripts/testing/, per Restructure the T2 suite into docs/automated-testing/, one document per test #339.
  9. Boyscout: while working these endpoints, cover their id handling in both casings. Case-insensitive id handling is proven in SQL but unverified at the endpoints #341 owns the
    systematic sweep across every by-id endpoint; this issue is already exercising the ones the bundled
    import path touches, so covering them here is cheaper than a second visit. Record what is covered so
    Case-insensitive id handling is proven in SQL but unverified at the endpoints #341 does not duplicate it — and if one turns out wrong, that is Case-insensitive id handling is proven in SQL but unverified at the endpoints #341's bug to own, not a scope
    expansion of this issue.

Expected tests

Live/T2 only — the point is precisely what unit tests with stubbed services cannot reach, and what
repository-level tests with constructed fixtures cannot reach either.

Test class Test method Starts
— Live tests only ❌

Definition of done

  • All expected tests listed above start red before implementation
  • All requirements implemented
  • All expected tests pass (green)
  • No regression in related tests
  • Findings summarised in a closing comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions