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 update repair tests aligned with fail-closed unit discovery

pulse-triage[bot]eebef3559f43
diff --git a/scripts/installtests/root_install_sh_test.go b/scripts/installtests/root_install_sh_test.go
index 17d213857b..5804b1063c 100644
--- a/scripts/installtests/root_install_sh_test.go
+++ b/scripts/installtests/root_install_sh_test.go
@@ -2351,10 +2351,25 @@ func TestRootInstallScriptUpdateFlowsRepairHalfRemovedInstall(t *testing.T) {
t.Fatalf("read root install.sh: %v", err)
}
- wired := regexp.MustCompile(`(?m)^\s*download_pulse\n(?:\s*#[^\n]*\n)*\s*setup_directories\n\s*setup_update_command\n\s*ensure_systemd_service_installed$`)
+ // Discovery can now refuse a unit repair even when the caller disables
+ // implicit errexit. Keep the original directory/helper/unit ordering and
+ // require that explicit refusal propagation in both update flows.
+ wired := regexp.MustCompile(`(?m)^\s*download_pulse\n(?:\s*#[^\n]*\n)*\s*setup_directories\n\s*setup_update_command\n\s*ensure_systemd_service_installed \|\| return 1$`)
if got := len(wired.FindAll(content, -1)); got != 2 {
t.Fatalf("expected both update flows (--version and menu update) to run setup_directories and ensure_systemd_service_installed after download_pulse, found %d", got)
}
+ for _, step := range []string{"setup_directories", "setup_update_command", "ensure_systemd_service_installed || return 1"} {
+ t.Run("missing "+step, func(t *testing.T) {
+ withoutStep := strings.ReplaceAll(string(content), step, ":")
+ if got := len(wired.FindAllString(withoutStep, -1)); got != 0 {
+ t.Fatalf("update-flow guard accepted missing %q in %d flows", step, got)
+ }
+ })
+ }
+ withoutRefusal := strings.ReplaceAll(string(content), "ensure_systemd_service_installed || return 1", "ensure_systemd_service_installed")
+ if got := len(wired.FindAllString(withoutRefusal, -1)); got != 0 {
+ t.Fatalf("update-flow guard accepted %d unit repairs without refusal propagation", got)
+ }
}
func TestRootInstallEnsureSystemdServiceRecreatesMissingUnit(t *testing.T) {