fix(P26): generalize run_platform.sh check-only assertions for all contracts
The --check-only mode hardcoded static-assets-specific assertions (stack name == 'static-assets', 'aws_s3_bucket' in main.tf, 'acdl-spike-bucket' in main.tf). The platform-test.yml integration-test stage runs check-only for every contracts/*.yaml, so contracts/microservice.yaml would fail the AssertionError. Replace with generic structural checks valid for any contract. verify(P0): code review — correctness ---ci--- phase: 26 milestone: v1.7 status: verify lessons: - P0 fix applied: run_platform.sh check-only hardcoded static-assets assertions broke for non-static-assets contracts (microservice); generalized to structural checks ---/ci---
This commit is contained in:
@@ -135,21 +135,19 @@ if [ "$CHECK_ONLY" = "1" ]; then
|
||||
python3 -c "
|
||||
import json, os
|
||||
d = json.load(open('$WORK/stack.json'))
|
||||
assert d['stack']['name'] == 'static-assets', f\"expected static-assets, got {d['stack']['name']}\"
|
||||
assert len(d['resources']) >= 1
|
||||
assert d['stack']['name'], 'stack name missing'
|
||||
assert len(d['resources']) >= 1, 'expected at least 1 resource'
|
||||
tf_dir = 'terraform/spike'
|
||||
for f in ('main.tf', 'terraform.tf', 'providers.tf'):
|
||||
assert os.path.isfile(os.path.join(tf_dir, f)), f'{f} missing'
|
||||
main = open(os.path.join(tf_dir, 'main.tf')).read()
|
||||
assert 'aws_s3_bucket' in main
|
||||
assert 'acdl-spike-bucket' in main
|
||||
assert 'versioning' in main
|
||||
assert len(main) > 0, 'main.tf is empty'
|
||||
tf = open(os.path.join(tf_dir, 'terraform.tf')).read()
|
||||
assert 'backend' in tf
|
||||
assert 'required_version' in tf
|
||||
prov = open(os.path.join(tf_dir, 'providers.tf')).read()
|
||||
assert 'provider \"aws\"' in prov
|
||||
print('adapter output: OK')
|
||||
print(f\"adapter output: OK ({d['stack']['name']}, {len(d['resources'])} resource(s))\")
|
||||
"
|
||||
echo ""
|
||||
echo "=== PLATFORM CHECK OK ==="
|
||||
|
||||
Reference in New Issue
Block a user