fix(11-08): make transaction gates fail closed
This commit is contained in:
@@ -54,6 +54,7 @@ require = set(os.environ.get("PHASE10_REQUIRE", "").split())
|
||||
expect_skip = set(os.environ.get("PHASE10_EXPECT_SKIP", "").split())
|
||||
skip_text = os.environ.get("PHASE10_SKIP_TEXT", "")
|
||||
skip_output = {}
|
||||
skipped = set()
|
||||
passed = set()
|
||||
failed_tests = {}
|
||||
failed_pkgs = []
|
||||
@@ -79,6 +80,7 @@ with open(path, encoding="utf-8", errors="replace") as fh:
|
||||
# A later phase's documented pending test (for example the Phase
|
||||
# 12 broadcast goldens) may skip, but only with its pending text.
|
||||
if test in expect_skip and skip_text and any(skip_text in o for o in skip_output.get(test, [])):
|
||||
skipped.add(test)
|
||||
continue
|
||||
print(f"refuse: skipped {pkg} {test}", file=sys.stderr)
|
||||
sys.exit(2)
|
||||
@@ -117,6 +119,14 @@ missing = sorted(name for name in require if name not in passed)
|
||||
if missing:
|
||||
print("refuse: required tests did not pass: " + ", ".join(missing), file=sys.stderr)
|
||||
sys.exit(5)
|
||||
unexpected_passes = sorted(expect_skip & passed)
|
||||
missing_skips = sorted(expect_skip - skipped)
|
||||
if unexpected_passes:
|
||||
print("refuse: expected pending tests passed: " + ", ".join(unexpected_passes), file=sys.stderr)
|
||||
sys.exit(7)
|
||||
if missing_skips:
|
||||
print("refuse: expected pending skips did not occur: " + ", ".join(missing_skips), file=sys.stderr)
|
||||
sys.exit(7)
|
||||
if not passed:
|
||||
print("refuse: zero tests", file=sys.stderr)
|
||||
sys.exit(3)
|
||||
@@ -185,6 +195,10 @@ run_self_test() {
|
||||
PHASE10_EXPECT_SKIP="TestG/created" PHASE10_SKIP_TEXT="pending: Phase 12" expect_detect pending-skip-without-text 2 \
|
||||
'{"Action":"skip","Package":"p","Test":"TestG/created"}
|
||||
{"Action":"pass","Package":"p","Test":"TestG"}'
|
||||
PHASE10_EXPECT_SKIP="TestG/created" PHASE10_SKIP_TEXT="pending: Phase 12" expect_detect pending-skip-missing 7 \
|
||||
'{"Action":"pass","Package":"p","Test":"TestOther"}'
|
||||
PHASE10_EXPECT_SKIP="TestG/created" PHASE10_SKIP_TEXT="pending: Phase 12" expect_detect pending-skip-passes 7 \
|
||||
'{"Action":"pass","Package":"p","Test":"TestG/created"}'
|
||||
expect_detect zero 3 '{"Action":"pass","Package":"git.golem15.com/golem15/summercms/modules/cabana"}'
|
||||
expect_detect nonjson 4 '{"Action":"pass",'
|
||||
expect_detect build 1 '{"Action":"build-fail","ImportPath":"p"}
|
||||
|
||||
@@ -335,6 +335,9 @@ removal_table() {
|
||||
"hits=\"\"", "", "--self-test"],
|
||||
["RC-14", "T-11-31", "root", "modules/lagoon/transaction.go",
|
||||
"if transactionalHandle(db) {",
|
||||
"if false {", "./modules/lagoon", "^TestTransactionAfterCommit$"],
|
||||
["RC-15", "T-11-31", "root", "modules/lagoon/transaction.go",
|
||||
"if !parent.owns(gdb) {",
|
||||
"if false {", "./modules/lagoon", "^TestTransactionAfterCommit$"]
|
||||
]
|
||||
EOF
|
||||
@@ -646,7 +649,7 @@ run_named() {
|
||||
TestScheduledEntryMismatchSkipped TestScheduleUniqueByPeriod TestScheduleRunForeground TestScheduleValidation \
|
||||
TestScheduleOrdering TestScheduleMissingCatalog TestScheduleLogWriter TestScheduleDueAt
|
||||
phase11_tests "$ROOT" ./modules/bonfire TestCall TestCallEdges
|
||||
phase11_tests "$ROOT" ./modules/lagoon TestOnDatabaseAfterActivate TestQueueMigrationsUpDown TestTransactionAfterCommit
|
||||
phase11_tests "$ROOT" ./modules/lagoon TestOnDatabaseAfterActivate TestQueueMigrationsUpDown TestTransactionAfterCommit TestTransactionEdges
|
||||
phase11_tests "$ROOT" ./modules/lighthouse TestBroadcastTx TestSuppression TestBulkEmitsOnce TestBroadcastEdges \
|
||||
TestBroadcastSwallowedReadFailure TestMountSurfaces TestChannelIDMatchesPHP TestParseChannel TestRegistry
|
||||
phase11_tests "$ROOT" ./modules/lighthouse/centrifugo TestTokenClaims TestTokenHandler TestClientRequests TestProxy TestHealthCommand
|
||||
|
||||
Reference in New Issue
Block a user