"""Release configuration safeguards; no credentials or cloud access required.""" import subprocess import unittest from pathlib import Path ROOT = Path(__file__).resolve().parents[1] class DeploymentReleaseTests(unittest.TestCase): def test_container_entrypoint_normalizes_windows_line_endings(self): self.assertIn("sed -i 's/\\r$//' /app/docker-entrypoint.sh", (ROOT / "Dockerfile").read_text(encoding="utf-8")) def test_cloud_ports_remain_loopback_only(self): compose = (ROOT / "deploy/docker-compose.aliyun.yml").read_text(encoding="utf-8") self.assertIn('"127.0.0.1:${FRONTEND_PORT:-80}:3000"', compose) self.assertIn('"127.0.0.1:${BACKEND_PORT:-8002}:8002"', compose) def test_chat_compatibility_is_forwarded_without_forcing_a_provider(self): for filename in ("docker-compose.yml", "deploy/docker-compose.aliyun.yml"): with self.subTest(filename=filename): self.assertIn("CHAT_THINKING_MODE: ${CHAT_THINKING_MODE:-}", (ROOT / filename).read_text(encoding="utf-8")) def test_runtime_data_and_private_configuration_are_not_packaged(self): excluded = set((ROOT / ".dockerignore").read_text(encoding="utf-8").splitlines()) required = {"backend/.env", "deploy/*.env", "backend/sessions", "backend/storage", "backend/raw_logs", "backend/backend", "backend/xingbang_data", "backend/xingbang_output", "backend/xingbang_evolution", "test-evidence", "ori_file", "ori_meetingfile", "_backup*"} self.assertTrue(required <= excluded, required - excluded) self.assertNotIn("backend/fixtures", excluded) def test_cloud_secrets_and_source_material_are_git_ignored(self): result = subprocess.run( ["git", "check-ignore", "deploy/aliyun.env", "ori_file/private.md"], cwd=ROOT, capture_output=True, text=True, check=True, ) self.assertEqual(set(result.stdout.splitlines()), {"deploy/aliyun.env", "ori_file/private.md"}) if __name__ == "__main__": unittest.main()