Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Repair smoke qualification of stable metadata and proxy trust guidance

pulse-triage[bot]75de65b33813
diff --git a/scripts/tests/test-pulse-auto-update.sh b/scripts/tests/test-pulse-auto-update.sh
index 0b234f0924..c007302886 100755
--- a/scripts/tests/test-pulse-auto-update.sh
+++ b/scripts/tests/test-pulse-auto-update.sh
@@ -88,11 +88,12 @@ test_get_latest_stable_version_prefers_highest_over_created_order() {
if [[ "$url" == *"/releases?per_page="* ]]; then
cat <<'EOF'
[
- { "tag_name": "v5.1.37", "prerelease": false },
- { "tag_name": "helm-chart-6.0.5", "prerelease": true },
- { "tag_name": "v6.0.5", "prerelease": false },
- { "tag_name": "v6.0.5-rc.4", "prerelease": true },
- { "tag_name": "v6.0.4", "prerelease": false }
+ { "tag_name": "v5.1.37", "draft": false, "prerelease": false },
+ { "tag_name": "helm-chart-6.0.5", "draft": false, "prerelease": false },
+ { "tag_name": "v99.0.0", "draft": true, "prerelease": false },
+ { "tag_name": "v6.0.5", "draft": false, "prerelease": false },
+ { "tag_name": "v6.0.5-rc.4", "draft": false, "prerelease": true },
+ { "tag_name": "v6.0.4", "draft": false, "prerelease": false }
]
EOF
return 0
@@ -112,6 +113,30 @@ EOF
return 0
}
+test_get_latest_stable_version_rejects_incomplete_maturity() {
+ # Missing fields must remain unknown, not default to published stable.
+ # Both transport paths are confined; this test makes no provider request.
+ curl() {
+ local url="${*: -1}"
+ case "$url" in
+ */releases\?per_page=*)
+ printf '%s\n' '[{"tag_name":"v99.0.0","prerelease":false},{"tag_name":"v99.0.1","draft":false}]'
+ ;;
+ */releases/latest)
+ printf '%s\n' '{"tag_name":"v99.0.0","prerelease":false}'
+ ;;
+ *) echo "unexpected curl call in test: $*" >&2; return 1 ;;
+ esac
+ }
+ local got
+ got=$(get_latest_stable_version)
+ unset -f curl
+ if [[ -n "$got" ]]; then
+ echo "incomplete maturity must not select an unattended update, got $got" >&2
+ return 1
+ fi
+}
+
test_perform_update_restores_backup_when_service_stays_down() {
local tmpdir
tmpdir="$(mktemp -d)"
@@ -446,6 +471,7 @@ main() {
assert_success "wait_for_service_active times out when never active" test_wait_for_service_active_times_out_when_never_active
assert_success "pick_highest_stable_tag ignores list order and prereleases" test_pick_highest_stable_tag_ignores_list_order_and_prereleases
assert_success "get_latest_stable_version prefers highest version over created order" test_get_latest_stable_version_prefers_highest_over_created_order
+ assert_success "get_latest_stable_version refuses incomplete maturity" test_get_latest_stable_version_rejects_incomplete_maturity
assert_success "perform_update restores backup when service stays down" test_perform_update_restores_backup_when_service_stays_down
assert_success "ensure_service_restarted no-ops when service was inactive" test_ensure_service_restarted_noops_when_service_was_inactive
assert_success "ensure_service_restarted starts a stopped service" test_ensure_service_restarted_starts_stopped_service
diff --git a/scripts/tests/test_authentication_diagnostic_docs.py b/scripts/tests/test_authentication_diagnostic_docs.py
index d5093c39bf..ad7d9c66ea 100644
--- a/scripts/tests/test_authentication_diagnostic_docs.py
+++ b/scripts/tests/test_authentication_diagnostic_docs.py
@@ -34,6 +34,18 @@ def blocks(name):
return re.findall(r"```bash\n(.*?)```", DOCUMENTS[name].read_text(), re.DOTALL)
+def markdown_section(source, heading):
+ # Emoji presentation selectors do not change the heading's meaning. Keep
+ # exact heading identity and uniqueness, rather than matching the whole doc
+ # when the intended safety section is missing or duplicated.
+ sections = re.findall(r"^## ([^\n]+)\n(.*?)(?=^## |\Z)", source, re.MULTILINE | re.DOTALL)
+ matching = [body for title, body in sections
+ if title.replace("\ufe0f", "") == heading.replace("\ufe0f", "")]
+ if len(matching) != 1:
+ raise AssertionError(f"Expected exactly one {heading} section, found {len(matching)}")
+ return " ".join(matching[0].split())
+
+
@contextmanager
def proxy_server(status):
requests = []
@@ -203,8 +215,9 @@ class AuthenticationDiagnosticDocsTest(unittest.TestCase):
self.assertNotIn(unexpected, headers)
def test_proxy_setup_cannot_omit_role_choice_and_authenticated_boundary(self):
- proxy = " ".join(DOCUMENTS["PROXY_AUTH"].read_text().split())
- quick = proxy.split("## 🚀 Quick Start", 1)[1].split("## ⚙️ Configuration", 1)[0]
+ source = DOCUMENTS["PROXY_AUTH"].read_text()
+ proxy = " ".join(source.split())
+ quick = markdown_section(source, "🚀 Quick Start")
for phrase in ("every proxy-authenticated user an administrator",
"PROXY_AUTH_ROLE_HEADER=X-Authentik-Groups",
"PROXY_AUTH_ADMIN_ROLE=<exact-idp-admin-group>",
@@ -215,11 +228,22 @@ class AuthenticationDiagnosticDocsTest(unittest.TestCase):
"existing administrator recovery path"):
with self.subTest(phrase=phrase):
self.assertIn(phrase, proxy if phrase == "actual group separator" else quick)
- boundary = proxy.split("## ⚠️ Header Trust Boundary", 1)[1].split("## 📦 Examples", 1)[0]
+ boundary = markdown_section(source, "⚠ Header Trust Boundary")
for phrase in ("replace", "never append", "first", "username and configured role header",
"must also come from the successful authenticator", "not be reachable"):
self.assertIn(phrase, boundary)
+ def test_proxy_boundary_heading_preserves_identity_not_emoji_presentation(self):
+ source = DOCUMENTS["PROXY_AUTH"].read_text()
+ expected = markdown_section(source, "⚠ Header Trust Boundary")
+ self.assertIn("never append", expected)
+ self.assertEqual(markdown_section(source.replace("## ⚠ Header", "## ⚠️ Header"),
+ "⚠ Header Trust Boundary"), expected)
+ for changed in (source.replace("## ⚠ Header Trust Boundary", "## ⚠ Different Boundary"),
+ source + "\n## ⚠️ Header Trust Boundary\nDuplicate section.\n"):
+ with self.subTest(changed=changed[-50:]), self.assertRaisesRegex(AssertionError, "exactly one"):
+ markdown_section(changed, "⚠ Header Trust Boundary")
+
def test_provider_mappings_are_not_headers_only_deployment_recipes(self):
proxy = " ".join(DOCUMENTS["PROXY_AUTH"].read_text().split())
examples = proxy.split("## 📦 Examples", 1)[1].split("## 🔧 Troubleshooting", 1)[0]