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.

Keep updater proof controls within their declared scopes

pulse-triage[bot]e05335517937
diff --git a/scripts/installtests/pulse_auto_update_test.go b/scripts/installtests/pulse_auto_update_test.go
index 8b6a77cf5d..d4b59e0a17 100644
--- a/scripts/installtests/pulse_auto_update_test.go
+++ b/scripts/installtests/pulse_auto_update_test.go
@@ -145,8 +145,6 @@ func TestAutoUpdateServiceStateFailsClosed(t *testing.T) {
"test_rollback_keeps_backup_until_restored_running_executable_matches",
"test_early_collector_failure_survives_later_success_and_drains_installer",
"test_unterminated_final_installer_line_is_collected_and_its_failure_retained",
- "test_real_log_retains_each_sink_failure_in_conditional_calls",
- "test_real_logger_failure_drains_installer_and_preserves_recovery",
}
for _, name := range required {
passed := false
@@ -161,6 +159,33 @@ func TestAutoUpdateServiceStateFailsClosed(t *testing.T) {
}
}
+// Keep the full real-sink matrix mandatory, but give it its own existing-size
+// bound rather than exhausting the service-state suite's manager deadlines.
+func TestAutoUpdateLogSinkFailures(t *testing.T) {
+ ctx, cancel := context.WithTimeout(context.Background(), 45*time.Second)
+ defer cancel()
+ cmd := exec.CommandContext(ctx, "python3", repoFile("scripts", "tests", "test_auto_update_service_state.py"), "-v", "UpdateLogSinks")
+ cmd.Env = append(os.Environ(), "PULSE_AUTO_UPDATER_UNDER_TEST="+repoFile("scripts", "pulse-auto-update.sh"))
+ out, err := cmd.CombinedOutput()
+ if err != nil {
+ t.Fatalf("unattended real-log sink controls: %v\n%s", err, out)
+ }
+ for _, name := range []string{
+ "test_real_log_retains_each_sink_failure_in_conditional_calls",
+ "test_real_logger_failure_drains_installer_and_preserves_recovery",
+ } {
+ passed := false
+ for _, line := range strings.Split(string(out), "\n") {
+ if strings.HasPrefix(line, name+" (") && strings.HasSuffix(line, " ... ok") {
+ passed = true
+ }
+ }
+ if !passed {
+ t.Fatalf("required real-log sink control %s did not pass:\n%s", name, out)
+ }
+ }
+}
+
// A real owned process retains its old executable after its disk path changes.
// This tests Linux process identity, not a native systemd/application journey.
func TestAutoUpdateRunningExecutableIdentity(t *testing.T) {
diff --git a/scripts/tests/test_auto_update_service_state.py b/scripts/tests/test_auto_update_service_state.py
index 382e46b9d3..b0c4800d0f 100644
--- a/scripts/tests/test_auto_update_service_state.py
+++ b/scripts/tests/test_auto_update_service_state.py
@@ -84,7 +84,9 @@ fi
# This transaction fixture has a simulated manager and shell-script binaries.
# The separate process controls below exercise the production /proc comparison.
verify_update_running_executable() {
- printf '%s\n' "$(get_current_version)" >> "$FIXTURE/runtime-probes"
+ local fixture_version=""
+ IFS= read -r fixture_version < "$INSTALL_DIR/VERSION"
+ printf '%s\n' "$fixture_version" >> "$FIXTURE/runtime-probes"
return "$RUNTIME_EXIT"
}
detect_service_name() { printf '%s\n' "$SERVICE_NAME"; }
@@ -143,7 +145,7 @@ sys.exit(0)
'''
-class UpdateServiceState(unittest.TestCase):
+class UpdaterFixture(unittest.TestCase):
def run_fixture(self, *, mode="normal", state="active", load="loaded", success=False, flow="update",
installer_exit=None, collector_exit=0, installer_output=None, collector_failures=None,
real_log=False, runtime_exit=0, installer_state=None):
@@ -213,6 +215,10 @@ class UpdateServiceState(unittest.TestCase):
self.assertIn("pulse-custom@department", args)
return observation
+
+class UpdateLogSinks(UpdaterFixture):
+ # Keep the expensive real-collector matrix separate from manager timeout
+ # controls, without widening their deadline or dropping any combinations.
def test_real_log_retains_each_sink_failure_in_conditional_calls(self):
for logger_exit, closed_stdout, expected in ((0, False, 0), (73, False, 73),
(0, True, 1), (73, True, 73)):
@@ -268,6 +274,8 @@ class UpdateServiceState(unittest.TestCase):
self.assertEqual(r["started"], state == "active")
self.assertEqual(r["backups"], [])
+
+class UpdateServiceState(UpdaterFixture):
def test_success_cannot_claim_unverified_running_executable(self):
# A matching new disk version and an active manager are insufficient.
# Preserve the currently active service; uncertainty grants no stop,
diff --git a/scripts/tests/test_auto_update_systemd.py b/scripts/tests/test_auto_update_systemd.py
index a3c4b346e9..305a3fcb27 100644
--- a/scripts/tests/test_auto_update_systemd.py
+++ b/scripts/tests/test_auto_update_systemd.py
@@ -19,7 +19,7 @@ native = importlib.util.module_from_spec(SPEC)
SPEC.loader.exec_module(native)
WORKFLOW = ROOT / ".github/workflows/build-and-test.yml"
STEP = "Check current-source unattended recovery on native systemd"
-FIXTURE_COMMANDS = ("bash", "tar", "chmod", "mv", "timeout")
+FIXTURE_COMMANDS = ("bash", "tar", "chmod", "mv", "timeout", "cmp")
LINUX_CONTROL = "test_connected_signed_archive_and_recovery_controls_without_host_manager"
LINUX_ONLY_REASON = "Linux server ELF execution; portable controls remain required on macOS"
@@ -481,7 +481,8 @@ elif args[0] not in ("daemon-reload", "reset-failed"): sys.exit(97)
tool_trace = base / "selected-tools.jsonl"
for name, executable in selected.items():
# Record only tool identity, never shell arguments or key/log
- # bytes. Execute the actual supplied GNU utility, not a double.
+ # bytes. Execute the actual supplied GNU utility; only the
+ # manager double's fixed process path is redirected below.
tool = tools / name
tool.write_text(f'''#!{sys.executable}
import json, os, pathlib, sys