mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-02 22:41:01 +02:00
Squashed 'ai-context/trustgraph-templates/' content from commit 42a5fd1b
git-subtree-dir: ai-context/trustgraph-templates git-subtree-split: 42a5fd1b678f32be378062e30451e2052ccb95dd
This commit is contained in:
commit
74cc8a4685
1216 changed files with 116347 additions and 0 deletions
57
tests/validation/test_syntax.py
Normal file
57
tests/validation/test_syntax.py
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
"""
|
||||
Syntax validation tests for generated outputs.
|
||||
"""
|
||||
|
||||
import pytest
|
||||
import json
|
||||
import yaml
|
||||
|
||||
|
||||
@pytest.mark.validation
|
||||
@pytest.mark.parametrize("platform", ["docker-compose", "minikube-k8s"])
|
||||
@pytest.mark.parametrize("config", ["minimal.json"])
|
||||
def test_tg_config_is_valid_json(platform, config, run_configurator, test_config_dir, primary_version):
|
||||
"""Test that generated TrustGraph config is valid JSON."""
|
||||
config_file = str(test_config_dir / config)
|
||||
|
||||
stdout, stderr, code = run_configurator([
|
||||
'-t', primary_version,
|
||||
'-p', platform,
|
||||
'-i', config_file,
|
||||
'--latest-stable',
|
||||
'-O'
|
||||
])
|
||||
|
||||
assert code == 0
|
||||
|
||||
# Should parse as valid JSON
|
||||
try:
|
||||
parsed = json.loads(stdout)
|
||||
assert parsed is not None
|
||||
except json.JSONDecodeError as e:
|
||||
pytest.fail(f"Invalid JSON: {e}")
|
||||
|
||||
|
||||
@pytest.mark.validation
|
||||
@pytest.mark.parametrize("platform", ["docker-compose", "minikube-k8s"])
|
||||
@pytest.mark.parametrize("config", ["minimal.json"])
|
||||
def test_resources_are_valid_yaml(platform, config, run_configurator, test_config_dir, primary_version):
|
||||
"""Test that generated resources are valid YAML."""
|
||||
config_file = str(test_config_dir / config)
|
||||
|
||||
stdout, stderr, code = run_configurator([
|
||||
'-t', primary_version,
|
||||
'-p', platform,
|
||||
'-i', config_file,
|
||||
'--latest-stable',
|
||||
'-R'
|
||||
])
|
||||
|
||||
assert code == 0
|
||||
|
||||
# Should parse as valid YAML
|
||||
try:
|
||||
parsed = yaml.safe_load(stdout)
|
||||
assert parsed is not None
|
||||
except yaml.YAMLError as e:
|
||||
pytest.fail(f"Invalid YAML: {e}")
|
||||
Loading…
Add table
Add a link
Reference in a new issue