Skip to content

Commit e1d4daf

Browse files
committed
test: add conformance fixtures (good/bad) and validate them
1 parent 32ee580 commit e1d4daf

File tree

3 files changed

+61
-2
lines changed

3 files changed

+61
-2
lines changed

Makefile

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,17 @@ deps: venv
2929
validate:
3030
$(PY) tools/validate_contract.py examples/pixi-dev.json
3131
$(PY) tools/validate_contract.py examples/truth-lane-container.json
32+
@for f in conformance/good/*.json; do \
33+
echo "VALID (good): $$f"; \
34+
$(PY) tools/validate_contract.py "$$f"; \
35+
done
36+
@for f in conformance/bad/*.json; do \
37+
echo "INVALID (bad): $$f"; \
38+
if $(PY) tools/validate_contract.py "$$f" >/dev/null 2>&1; then \
39+
echo "ERR: expected failure but validated: $$f"; \
40+
exit 1; \
41+
else \
42+
echo "OK: failed as expected: $$f"; \
43+
fi; \
44+
done
3245

33-
clean:
34-
rm -rf $(VENV) __pycache__ .pytest_cache

conformance/bad/container-tag.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"api_version": "workstation-contracts.socios.io/v0.1",
3+
"kind": "WorkstationContract",
4+
"metadata": {
5+
"id": "conformance-bad-container-tag",
6+
"name": "Bad container tag pin"
7+
},
8+
"spec": {
9+
"lanes": [
10+
{
11+
"name": "truth",
12+
"backend": {
13+
"type": "container",
14+
"container": {
15+
"image": "ghcr.io/socios-linux/truth-lane:latest"
16+
}
17+
}
18+
}
19+
]
20+
}
21+
}

conformance/good/min.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"api_version": "workstation-contracts.socios.io/v0.1",
3+
"kind": "WorkstationContract",
4+
"metadata": {
5+
"id": "conformance-good-min",
6+
"name": "Good minimal"
7+
},
8+
"spec": {
9+
"lanes": [
10+
{
11+
"name": "dev",
12+
"backend": {
13+
"type": "pixi",
14+
"pixi": {
15+
"manifest": "pixi.toml"
16+
}
17+
},
18+
"steps": [
19+
{
20+
"name": "noop",
21+
"run": "echo ok"
22+
}
23+
]
24+
}
25+
]
26+
}
27+
}

0 commit comments

Comments
 (0)