Repository navigation
Open
Labels
BacklogNot started: the work waits in the backlogclass:INVInnovation: a new feature, design, idea or methodstatus:openNo fix yettaskA unit of work with no user story
Description
Part of #18
What is wanted
A test of the service suite checks each HTTP call of the two adapters against the provider's own published description, with no server and no container. Spike #187 measured the method: 23 calls of core/git/github.py (22 operations) against GitHub's OpenAPI description, and 48 calls of core/clients/kube.py (40 operations) against the Kubernetes API description. Both comparisons found 0 differences, in 0.47 s and 0.16 s, and mutants of each comparison failed.
Where
- New:
cmapi/tests/service/test_adapter_contracts.py, andcmapi/tests/contracts/with one pinned extract for each provider. - New:
scripts/provider-contracts.py. It reads a provider's full description and writes the extract: only the operations that the adapters call, with each reference resolved, the source commit and the date. - The adapters:
cmapi/src/cmapi/core/git/github.py,cmapi/src/cmapi/core/clients/kube.py.
Acceptance criteria
- The test records each request that the adapter sends, on a mock transport, for each method of the port. It does not read a hand-written list of calls. Proof: the test fails when a method of
GitHubProviderorKubeClienthas no recorded request. - Each recorded request is valid for the extract: the path and method, each query parameter, each body field, each required body field, and the content type. Proof: a mutant of the adapter with a wrong field fails the test.
- Each answer of the mock transport that the tests give (
test_github_check_runs.pyand the new ones) is valid for the answer schema of the extract. Proof: a mutant answer with a wrong field fails. - The extracts are small (under 300 KB each) and say their source: the repository, the commit and the date.
scripts/provider-contracts.py --check <description>fails when the extract differs from a new description. Proof: its own test with a changed description. docs/08says what the test covers and what it does not: the meaning of an answer, rate limits and server-side apply conflicts are not in a description.
Not in this task
A real API server for Kubernetes (envtest or kwok with its binary runtime) and recorded answers from a real run against GitHub (#61). The spike's record says when each one is the better tool.
Class
INV. The task adds a check and changes no behaviour.
Metadata
Metadata
Assignees
Labels
BacklogNot started: the work waits in the backlogclass:INVInnovation: a new feature, design, idea or methodstatus:openNo fix yettaskA unit of work with no user story
Activity
Records: OB1 run 3 handed back (6 PRs, main 89ecb07); #200 and #204 f…