Skip to content

Commit 574ffd9

Browse files
Version Python control-plane parity fixtures
Version control-plane parity fixtures
1 parent 026c90c commit 574ffd9

5 files changed

Lines changed: 38 additions & 0 deletions

File tree

tests/fixtures/control-plane/namespace-create-parity.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"schema": "durable-workflow.polyglot.control-plane-request-fixture",
3+
"version": 1,
34
"operation": "namespace.create",
45
"request": {
56
"method": "POST",

tests/fixtures/control-plane/namespace-describe-parity.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"schema": "durable-workflow.polyglot.control-plane-request-fixture",
3+
"version": 1,
34
"operation": "namespace.describe",
45
"request": {
56
"method": "GET",

tests/fixtures/control-plane/namespace-list-parity.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"schema": "durable-workflow.polyglot.control-plane-request-fixture",
3+
"version": 1,
34
"operation": "namespace.list",
45
"request": {
56
"method": "GET",

tests/fixtures/control-plane/namespace-update-parity.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"schema": "durable-workflow.polyglot.control-plane-request-fixture",
3+
"version": 1,
34
"operation": "namespace.update",
45
"request": {
56
"method": "PUT",
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
from __future__ import annotations
2+
3+
import json
4+
from pathlib import Path
5+
6+
FIXTURE_SCHEMA = "durable-workflow.polyglot.control-plane-request-fixture"
7+
FIXTURE_VERSION = 1
8+
FIXTURES = Path(__file__).parent / "fixtures" / "control-plane"
9+
10+
11+
def test_control_plane_parity_fixtures_are_versioned_contracts() -> None:
12+
paths = sorted(FIXTURES.glob("*-parity.json"))
13+
assert paths, f"expected control-plane parity fixtures in {FIXTURES}"
14+
15+
for path in paths:
16+
fixture = json.loads(path.read_text())
17+
assert fixture.get("schema") == FIXTURE_SCHEMA, (
18+
f"{path.name} must declare the shared control-plane parity fixture schema"
19+
)
20+
assert fixture.get("version") == FIXTURE_VERSION, (
21+
f"{path.name} must declare fixture contract version {FIXTURE_VERSION}"
22+
)
23+
assert fixture.get("operation"), f"{path.name} must name the operation"
24+
25+
request = fixture.get("request")
26+
assert isinstance(request, dict), f"{path.name} must declare the request shape"
27+
assert request.get("method"), f"{path.name} must declare request.method"
28+
assert str(request.get("path", "")).startswith("/"), f"{path.name} must declare request.path"
29+
30+
assert isinstance(fixture.get("semantic_body"), dict), f"{path.name} must declare semantic_body"
31+
assert isinstance(fixture.get("cli"), dict), f"{path.name} must declare the CLI projection"
32+
assert isinstance(fixture.get("sdk_python"), dict), (
33+
f"{path.name} must declare the Python SDK projection"
34+
)

0 commit comments

Comments
 (0)