fix: address rotation-revocation narrow verify findings
Name restarting both the LB and the replicas when the LB has no ready replica, state the measured 25 s bound of the LB metrics port, narrow the missing files of a held identity to its certificate, and cover refusals and signals during CRL issue with fast tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -364,19 +364,25 @@ def _revoked(root: Path) -> bool:
|
||||
return row.startswith("R")
|
||||
|
||||
|
||||
@pytest.mark.parametrize("step", ["-revoke", "-gencrl"])
|
||||
@pytest.mark.parametrize("when", ["before", "after"])
|
||||
@pytest.mark.parametrize("number", ["HUP", "INT", "TERM"])
|
||||
def test_hold_survives_a_signal(number: str, when: str, root: Path) -> None:
|
||||
"""Сигнал самой команде или всей группе во время отзыва (до записи в базу
|
||||
и после неё): отзыв доведён до CRL, отметка стоит — `stand` отозванной
|
||||
identity ключа не выдаст."""
|
||||
def test_hold_survives_a_signal(
|
||||
number: str,
|
||||
when: str,
|
||||
step: str,
|
||||
root: Path,
|
||||
) -> None:
|
||||
"""Сигнал самой команде или всей группе во время отзыва и выпуска CRL (до
|
||||
записи openssl и после неё): отзыв доведён до CRL, отметка стоит — `stand`
|
||||
отозванной identity ключа не выдаст."""
|
||||
body = (
|
||||
f"kill -{number} $PPID $$"
|
||||
if when == "before"
|
||||
else f'real "$@"; kill -{number} $PPID $$; exit 0'
|
||||
)
|
||||
crl = (root / "stand" / "crl.pem").read_bytes()
|
||||
env = _fake_openssl(root, "-revoke", body)
|
||||
env = _fake_openssl(root, step, body)
|
||||
result = _run_in(root, "revoke", "relay", "--hold", env=env)
|
||||
assert result.returncode == 0, result.stderr
|
||||
assert _revoked(root)
|
||||
@@ -506,6 +512,8 @@ def test_two_held_in_a_recreated_stand_directory(root: Path, pki: Run) -> None:
|
||||
)
|
||||
assert out.count(chain) == 2 # noqa: PLR2004
|
||||
assert "rotate worker;" not in out
|
||||
assert out.count("only from make rotate_leaf IDENTITY=") == 1
|
||||
assert "only from make rotate_leaf IDENTITY=worker" in out
|
||||
|
||||
|
||||
def test_hold_in_a_recreated_stand_directory(root: Path, pki: Run) -> None:
|
||||
@@ -516,6 +524,7 @@ def test_hold_in_a_recreated_stand_directory(root: Path, pki: Run) -> None:
|
||||
shutil.rmtree(root / "stand")
|
||||
out = pki("stand").stdout
|
||||
assert "held relay: missing" in out
|
||||
assert "rotate_leaf" not in out
|
||||
assert (
|
||||
"held relay: compose cannot start without its files; to return it: "
|
||||
"infra/pki/pki.sh rotate relay; make stop; make bao_unseal; "
|
||||
@@ -574,6 +583,7 @@ def test_status_marks_revoked(root: Path, pki: Run) -> None:
|
||||
def test_revoke_unknown_flag(root: Path, pki: Run, flag: str) -> None:
|
||||
before = _state(root)
|
||||
assert pki("revoke", "relay", flag).returncode == 2 # noqa: PLR2004
|
||||
assert "PKI_LOCK_WAIT" in pki("revoke", "relay", flag).stderr
|
||||
assert _state(root) == before
|
||||
assert "held" not in pki("stand").stdout
|
||||
|
||||
|
||||
Reference in New Issue
Block a user