fix: install.sh verification retry-loop + 12s sleep + precise journalctl timing

Post-Deployment-Verifikation im --update-only Block:
- Sleep von 8s auf 12s erhöht (Gateway braucht ~8-10s für Archivar/Connected)
- Retry-Schleife: bis zu 3 Versuche im Abstand von 5s (max 22s total)
- journalctl --since mit präzisem Zeitstempel (date) statt '2 minutes ago'
- --no-pager Flag für zuverlässige Ausgabe
- Jede Prüfung gibt Treffer-Anzahl aus (nicht nur 'NICHT gefunden')
- Erst nach 3 vergeblichen Versuchen -> die() mit Fehler

Tests: 7 neue Testfälle für retry-loop, timestamp, --no-pager, sleep 12,
hit counts, retry-wait-message. Alle 21 Tests grün.
This commit is contained in:
Bernd (Hermes)
2026-07-23 17:15:57 +02:00
parent a07ca22ca8
commit e72a5adb57
2 changed files with 111 additions and 27 deletions
+65
View File
@@ -225,6 +225,71 @@ class TestUpdateOnlyPostDeployVerification:
f"Keine Fehlerbehandlung (err/die/exit 1) bei Verifikation:\n{update_section}"
)
def test_retry_loop_present(self):
"""Verifikation nutzt Retry-Schleife mit bis zu 3 Versuchen."""
content = _read_install_sh()
update_section = _extract_update_only_section(content)
assert "_check_attempt" in update_section, (
f"Keine _check_attempt Variable (Retry-Schleife) im --update-only Block:\n{update_section}"
)
assert "for _check_attempt in 1 2 3" in update_section, (
f"Keine 'for _check_attempt in 1 2 3' Schleife:\n{update_section}"
)
def test_precise_timestamp(self):
"""journalctl nutzt präzisen Zeitstempel statt '2 minutes ago'."""
content = _read_install_sh()
update_section = _extract_update_only_section(content)
assert "_verify_since" in update_section, (
f"Keine _verify_since Variable (präziser Zeitstempel):\n{update_section}"
)
assert "date '+%Y-%m-%d %H:%M:%S'" in update_section, (
f"Kein date-Aufruf für präzisen Zeitstempel:\n{update_section}"
)
# Darf KEIN '2 minutes ago' mehr enthalten
assert "2 minutes ago" not in update_section, (
f"'2 minutes ago' noch im --update-only Block (sollte durch _verify_since ersetzt sein):\n{update_section}"
)
def test_no_pager_flag(self):
"""journalctl nutzt --no-pager für zuverlässige Ausgabe."""
content = _read_install_sh()
update_section = _extract_update_only_section(content)
assert "--no-pager" in update_section, (
f"Kein --no-pager Flag bei journalctl:\n{update_section}"
)
def test_sleep_12_seconds(self):
"""Initialer Sleep ist 12s (nicht 8s)."""
content = _read_install_sh()
update_section = _extract_update_only_section(content)
assert "sleep 12" in update_section, (
f"Kein 'sleep 12' im --update-only Block:\n{update_section}"
)
def test_hit_count_output(self):
"""Jede Prüfung gibt Treffer-Anzahl aus (nicht nur 'NICHT gefunden')."""
content = _read_install_sh()
update_section = _extract_update_only_section(content)
# Mindestens 3 Treffer-Ausgaben (eine pro Check)
assert update_section.count("Treffer") >= 3, (
f"Weniger als 3 'Treffer'-Ausgaben (sollte pro Check eine sein):\n{update_section}"
)
def test_retry_wait_message(self):
"""Zwischen Retry-Versuchen wird 'Warte 5s' ausgegeben."""
content = _read_install_sh()
update_section = _extract_update_only_section(content)
assert "Warte 5s" in update_section, (
f"Keine 'Warte 5s'-Meldung zwischen Retry-Versuchen:\n{update_section}"
)
# ═══════════════════════════════════════════════════════════════════════════
# Test 6: Idempotenz