Initial ABSDEV deployment framework development preview
ABSDEV Framework CI / framework-validation (push) Canceled after 0s
ABSDEV Framework CI / framework-validation (push) Canceled after 0s
This commit is contained in:
@@ -0,0 +1,118 @@
|
||||
import json
|
||||
import subprocess
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from core.inspection_cli import capabilities
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
|
||||
|
||||
class CIPolicyTests(unittest.TestCase):
|
||||
|
||||
def test_ci_script_exists(self):
|
||||
self.assertTrue(
|
||||
(ROOT / "scripts/ci-check.sh").is_file()
|
||||
)
|
||||
|
||||
def test_workflow_exists(self):
|
||||
self.assertTrue(
|
||||
(
|
||||
ROOT / ".gitea/workflows/framework-ci.yaml"
|
||||
).is_file()
|
||||
)
|
||||
|
||||
def test_ci_script_shell_syntax(self):
|
||||
result = subprocess.run(
|
||||
[
|
||||
"bash",
|
||||
"-n",
|
||||
str(ROOT / "scripts/ci-check.sh"),
|
||||
],
|
||||
capture_output=True,
|
||||
timeout=10,
|
||||
)
|
||||
|
||||
self.assertEqual(result.returncode, 0)
|
||||
|
||||
def test_ci_runs_unit_tests(self):
|
||||
source = (
|
||||
ROOT / "scripts/ci-check.sh"
|
||||
).read_text()
|
||||
|
||||
self.assertIn(
|
||||
"unittest discover -s tests/unit",
|
||||
source,
|
||||
)
|
||||
|
||||
def test_database_integration_disabled(self):
|
||||
source = (
|
||||
ROOT / "scripts/ci-check.sh"
|
||||
).read_text()
|
||||
|
||||
self.assertIn(
|
||||
"export ABSDEV_INTEGRATION_TESTS=0",
|
||||
source,
|
||||
)
|
||||
|
||||
def test_workflow_no_deployment_secrets(self):
|
||||
source = (
|
||||
ROOT / ".gitea/workflows/framework-ci.yaml"
|
||||
).read_text()
|
||||
|
||||
self.assertNotIn("secrets.", source)
|
||||
|
||||
def test_workflow_no_privileged_execution(self):
|
||||
source = (
|
||||
ROOT / ".gitea/workflows/framework-ci.yaml"
|
||||
).read_text()
|
||||
|
||||
self.assertNotIn("privileged: true", source)
|
||||
self.assertNotIn("sudo ", source)
|
||||
|
||||
def test_production_deployment_disabled(self):
|
||||
self.assertFalse(
|
||||
capabilities()["deployment_execution_enabled"]
|
||||
)
|
||||
|
||||
def test_production_migration_disabled(self):
|
||||
self.assertFalse(
|
||||
capabilities()["migration_execution_enabled"]
|
||||
)
|
||||
|
||||
def test_provisioning_disabled(self):
|
||||
self.assertFalse(
|
||||
capabilities()["provisioning_execution_enabled"]
|
||||
)
|
||||
|
||||
def test_database_restore_disabled(self):
|
||||
self.assertFalse(
|
||||
capabilities()["database_restore_enabled"]
|
||||
)
|
||||
|
||||
def test_permanent_deletion_disabled(self):
|
||||
self.assertFalse(
|
||||
capabilities()["permanent_deletion_enabled"]
|
||||
)
|
||||
|
||||
def test_production_ready_remains_false(self):
|
||||
self.assertFalse(
|
||||
capabilities()["production_ready"]
|
||||
)
|
||||
|
||||
def test_ci_calls_shared_verification_script(self):
|
||||
source = (
|
||||
ROOT / ".gitea/workflows/framework-ci.yaml"
|
||||
).read_text()
|
||||
|
||||
self.assertIn(
|
||||
"bash scripts/ci-check.sh",
|
||||
source,
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user