NAS 정식 스택과 배포 파이프라인 도구를 고정
This commit is contained in:
parent
f1b80676c1
commit
d6d9dc5f61
8 changed files with 812 additions and 1 deletions
|
|
@ -419,6 +419,122 @@ class OutcomeReleaseAgentTests(unittest.TestCase):
|
|||
self.agent_module.REQUIRED_RELEASE_PAYLOAD_PATHS,
|
||||
)
|
||||
|
||||
def test_single_active_session_index_is_online_and_release_required(self) -> None:
|
||||
migration_path = (
|
||||
SCRIPT_PATH.parent.parent
|
||||
/ "infra"
|
||||
/ "db"
|
||||
/ "init"
|
||||
/ "21_single_active_session.sql"
|
||||
)
|
||||
migration = migration_path.read_text(encoding="utf-8")
|
||||
|
||||
self.assertNotIn("BEGIN;", migration)
|
||||
self.assertIn(
|
||||
"CREATE UNIQUE INDEX CONCURRENTLY IF NOT EXISTS uq_sessions_one_active_learner_persona",
|
||||
migration,
|
||||
)
|
||||
self.assertIn("ON app.sessions (learner_id, persona_id)", migration)
|
||||
self.assertIn("WHERE ended_at IS NULL AND persona_id IS NOT NULL;", migration)
|
||||
self.assertIn(
|
||||
"duplicate active learner-persona sessions exist",
|
||||
migration,
|
||||
)
|
||||
self.assertIn(
|
||||
"target index exists but is invalid or has a different definition",
|
||||
migration,
|
||||
)
|
||||
self.assertIn("index_meta.indisvalid", migration)
|
||||
self.assertIn("index_meta.indisready", migration)
|
||||
self.assertIn("valid target unique index was not created", migration)
|
||||
self.assertNotIn("COMMIT;", migration)
|
||||
self.assertIn(
|
||||
"21_single_active_session.sql",
|
||||
self.agent_module.RELEASE_DB_MIGRATIONS,
|
||||
)
|
||||
self.assertIn(
|
||||
"21_single_active_session.sql",
|
||||
self.agent_module.RELEASE_DB_ONLINE_MIGRATIONS,
|
||||
)
|
||||
self.assertIn(
|
||||
"infra/db/init/21_single_active_session.sql",
|
||||
self.agent_module.REQUIRED_RELEASE_PAYLOAD_PATHS,
|
||||
)
|
||||
self.assertIn(
|
||||
"20_public_bootstrap_ticket_events.sql",
|
||||
self.agent_module.RELEASE_DB_MIGRATIONS,
|
||||
)
|
||||
self.assertNotIn(
|
||||
"20_public_bootstrap_ticket_events.sql",
|
||||
self.agent_module.RELEASE_DB_ONLINE_MIGRATIONS,
|
||||
)
|
||||
self.assertIn(
|
||||
"infra/db/init/20_public_bootstrap_ticket_events.sql",
|
||||
self.agent_module.REQUIRED_RELEASE_PAYLOAD_PATHS,
|
||||
)
|
||||
|
||||
def test_case_profile_multi_case_migration_is_online_safe_and_release_required(
|
||||
self,
|
||||
) -> None:
|
||||
migration_path = (
|
||||
SCRIPT_PATH.parent.parent
|
||||
/ "infra"
|
||||
/ "db"
|
||||
/ "init"
|
||||
/ "22_case_profile_multi_case.sql"
|
||||
)
|
||||
migration = migration_path.read_text(encoding="utf-8")
|
||||
|
||||
self.assertNotIn("BEGIN;", migration)
|
||||
self.assertNotIn("COMMIT;", migration)
|
||||
self.assertIn("legacy_constraints text[];", migration)
|
||||
self.assertIn("constraint_meta.contype = 'u'", migration)
|
||||
self.assertIn(
|
||||
"ARRAY['persona_id', 'learner_id']::text[]",
|
||||
migration,
|
||||
)
|
||||
self.assertIn(
|
||||
"multiple legacy case_profile persona-learner unique constraints exist",
|
||||
migration,
|
||||
)
|
||||
self.assertIn(
|
||||
"ALTER TABLE app.case_profile DROP CONSTRAINT %I",
|
||||
migration,
|
||||
)
|
||||
self.assertIn(
|
||||
"legacy case_profile persona-learner unique constraint remains",
|
||||
migration,
|
||||
)
|
||||
self.assertIn(
|
||||
"CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_case_profile_learner_persona_activity",
|
||||
migration,
|
||||
)
|
||||
self.assertIn(
|
||||
"ON app.case_profile (learner_id, persona_id, updated_at DESC, case_id);",
|
||||
migration,
|
||||
)
|
||||
self.assertIn("index_meta.indisvalid", migration)
|
||||
self.assertIn("index_meta.indisready", migration)
|
||||
self.assertIn("NOT index_meta.indisunique", migration)
|
||||
self.assertIn("index_meta.indnkeyatts = 4", migration)
|
||||
self.assertIn(
|
||||
"target index exists but is invalid or has a different definition",
|
||||
migration,
|
||||
)
|
||||
self.assertIn("valid case activity index was not created", migration)
|
||||
self.assertIn(
|
||||
"22_case_profile_multi_case.sql",
|
||||
self.agent_module.RELEASE_DB_MIGRATIONS,
|
||||
)
|
||||
self.assertIn(
|
||||
"22_case_profile_multi_case.sql",
|
||||
self.agent_module.RELEASE_DB_ONLINE_MIGRATIONS,
|
||||
)
|
||||
self.assertIn(
|
||||
"infra/db/init/22_case_profile_multi_case.sql",
|
||||
self.agent_module.REQUIRED_RELEASE_PAYLOAD_PATHS,
|
||||
)
|
||||
|
||||
def test_two_patch_runs_must_be_byte_identical_before_any_deploy(self) -> None:
|
||||
agent, runner, deployment, _, _ = self.make_agent(
|
||||
active_sha=None,
|
||||
|
|
@ -773,6 +889,9 @@ class OutcomeReleaseAgentTests(unittest.TestCase):
|
|||
"17_improvement_workbook_contracts.sql",
|
||||
"18_admin_usage_ledger_index.sql",
|
||||
"19_auth_identity_alias.sql",
|
||||
"20_public_bootstrap_ticket_events.sql",
|
||||
"21_single_active_session.sql",
|
||||
"22_case_profile_multi_case.sql",
|
||||
),
|
||||
self.agent_module.RELEASE_DB_MIGRATIONS,
|
||||
)
|
||||
|
|
@ -968,8 +1087,26 @@ class OutcomeReleaseAgentTests(unittest.TestCase):
|
|||
if "18_admin_usage_ledger_index.sql" in line
|
||||
and "psql -v ON_ERROR_STOP=1" in line
|
||||
)
|
||||
active_session_online_migration_command = next(
|
||||
line
|
||||
for line in promote_command.splitlines()
|
||||
if "21_single_active_session.sql" in line
|
||||
and "psql -v ON_ERROR_STOP=1" in line
|
||||
)
|
||||
case_profile_online_migration_command = next(
|
||||
line
|
||||
for line in promote_command.splitlines()
|
||||
if "22_case_profile_multi_case.sql" in line
|
||||
and "psql -v ON_ERROR_STOP=1" in line
|
||||
)
|
||||
self.assertIn("--single-transaction", transactional_migration_command)
|
||||
self.assertNotIn("--single-transaction", online_migration_command)
|
||||
self.assertNotIn(
|
||||
"--single-transaction", active_session_online_migration_command
|
||||
)
|
||||
self.assertNotIn(
|
||||
"--single-transaction", case_profile_online_migration_command
|
||||
)
|
||||
self.assertEqual(f"{root}/release/infra/.env", state["env_file"])
|
||||
|
||||
def test_adopted_legacy_state_infers_compose_adjacent_env_file(self) -> None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue