mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-09-30 06:53:12 +00:00
70 lines
2.1 KiB
Python
70 lines
2.1 KiB
Python
|
|
#!/usr/bin/env python3
|
||
|
|
"""Tests for check_app_terraform_isolation.isolation_violation."""
|
||
|
|
|
||
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
import unittest
|
||
|
|
|
||
|
|
from check_app_terraform_isolation import isolation_violation
|
||
|
|
|
||
|
|
|
||
|
|
class IsolationTests(unittest.TestCase):
|
||
|
|
def test_terraform_only(self) -> None:
|
||
|
|
self.assertIsNone(
|
||
|
|
isolation_violation(
|
||
|
|
[
|
||
|
|
"terraform/live/dev/main.tf",
|
||
|
|
"terraform/live/README.md",
|
||
|
|
]
|
||
|
|
)
|
||
|
|
)
|
||
|
|
|
||
|
|
def test_app_only(self) -> None:
|
||
|
|
self.assertIsNone(
|
||
|
|
isolation_violation(
|
||
|
|
[
|
||
|
|
"src/app/routes.tsx",
|
||
|
|
"public/favicon.ico",
|
||
|
|
"index.html",
|
||
|
|
]
|
||
|
|
)
|
||
|
|
)
|
||
|
|
|
||
|
|
def test_docs_workflows_and_gate_scripts_with_terraform(self) -> None:
|
||
|
|
self.assertIsNone(
|
||
|
|
isolation_violation(
|
||
|
|
[
|
||
|
|
"terraform/live/modules/environment-owned/main.tf",
|
||
|
|
".github/workflows/deploy-web.yaml",
|
||
|
|
"QUALITY_GATES.md",
|
||
|
|
"scripts/governance-check.mjs",
|
||
|
|
"scripts/check_app_terraform_isolation.py",
|
||
|
|
"package.json",
|
||
|
|
]
|
||
|
|
)
|
||
|
|
)
|
||
|
|
|
||
|
|
def test_mixed_src_and_terraform_fails(self) -> None:
|
||
|
|
violation = isolation_violation(
|
||
|
|
[
|
||
|
|
"terraform/live/dev/main.tf",
|
||
|
|
"src/app/routes.tsx",
|
||
|
|
]
|
||
|
|
)
|
||
|
|
self.assertIsNotNone(violation)
|
||
|
|
terraform_files, app_files = violation or ([], [])
|
||
|
|
self.assertEqual(terraform_files, ["terraform/live/dev/main.tf"])
|
||
|
|
self.assertEqual(app_files, ["src/app/routes.tsx"])
|
||
|
|
|
||
|
|
def test_mixed_vite_config_and_terraform_fails(self) -> None:
|
||
|
|
violation = isolation_violation(["terraform/live/dev/versions.tf", "vite.config.ts"])
|
||
|
|
self.assertIsNotNone(violation)
|
||
|
|
|
||
|
|
def test_mixed_env_and_terraform_fails(self) -> None:
|
||
|
|
violation = isolation_violation(["terraform/live/dev/main.tf", ".env.production"])
|
||
|
|
self.assertIsNotNone(violation)
|
||
|
|
|
||
|
|
|
||
|
|
if __name__ == "__main__":
|
||
|
|
unittest.main()
|