P2-ops: migration alignment, deploy test list, monitor alerts/single-host, backup/rollback closure, Caddy template
- migrations: MIGRATION_TABLES now equals POSTGRES_SCHEMA tables
(uploads, task_attachments, task_followups, environments added);
SEQUENCE_TABLES matches IDENTITY tables; task_followups
sender_task_id column ensured before insert; UNMIGRATED_TABLES
and migration_coverage() report tables with no PG schema instead
of silently skipping them; CLI prints the coverage report.
- deploy: DEFAULT_TEST_SUITES gains deploy/tests (discover -s only,
never package path); regression tests pin the default list.
- monitor: MONITOR_SINGLE_HOST=1 makes the server check single-host;
default stays dual to avoid silent downgrade; server_mode is in
the JSON. Optional fail-only alert outlet (webhook or mail,
default off, alert body is pass/fail JSON only, no secrets).
- backup/rollback: README and restore-drill document what is
recoverable (DB, code) vs not (worktrees, traces, uploads, host
configs); rollback.sh shares the server-unit list and dual-port
health success standard with host_deploy.sh (sync test guards it).
- public entry: Caddyfile uses native {$DOMAIN}/{$ACME_EMAIL}
variables plus a caddy.service template; README documents the
steps and the current BT-nginx production status.
This commit is contained in:
1 parent
ef532a38c2
commit
64995fafab
14 files changed
+953
-44
No files matched your search
@@ -82,6 +82,33 @@ class TestDeployPure(unittest.TestCase):
|
||||
self.assertIsNone(deploy_mod.live_commit("Warning: something\n"))
|
||||
|
||||
|
||||
class TestDefaultTestSuites(unittest.TestCase):
|
||||
"""P2-ops 回归:部署前默认清单必须含 deploy/tests,
|
||||
且 run_tests() 确实按 discover -s 逐套跑(不是包路径)。"""
|
||||
|
||||
def test_default_suites_include_deploy_tests(self):
|
||||
self.assertIn("deploy/tests", deploy_mod.DEFAULT_TEST_SUITES)
|
||||
self.assertIn("tests", deploy_mod.DEFAULT_TEST_SUITES)
|
||||
self.assertIn("cloud/tests", deploy_mod.DEFAULT_TEST_SUITES)
|
||||
|
||||
def test_run_tests_discovers_every_suite(self):
|
||||
calls = []
|
||||
|
||||
def fake_run(cmd, cwd=None, check=True):
|
||||
calls.append(cmd)
|
||||
return subprocess.CompletedProcess(args=cmd, returncode=0,
|
||||
stdout="", stderr="")
|
||||
|
||||
with mock.patch.object(deploy_mod, "run", side_effect=fake_run):
|
||||
deploy_mod.run_tests()
|
||||
discovered = [c[c.index("-s") + 1] for c in calls
|
||||
if "discover" in c]
|
||||
self.assertEqual(discovered, list(deploy_mod.DEFAULT_TEST_SUITES))
|
||||
# 没有任何一套走包路径(deploy.tests 会盖掉 deploy.py)。
|
||||
for c in calls:
|
||||
self.assertNotIn("deploy.tests", c)
|
||||
|
||||
|
||||
class TestBuildRelease(unittest.TestCase):
|
||||
def test_build_from_temp_git_repo(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
|
||||
Reference in new issue
Block a user