Files
Pulse/scripts/installtests/unraid_go_update_test.go
rcourtman f965314eaa Preflight Unraid boot file before stopping agent and report reason
On Unraid upgrades, install.sh previously stopped the running pulse-agent watchdog and binary before calling write_unraid_go_entry. When /boot/config/go contained a custom or unrecognized Pulse Agent line (such as a hand-edited setsid launch), a prior staging directory, or a missing trailing newline, write_unraid_go_entry returned 1 silently, left an empty go.pulse-setup.* staging directory behind, and exited with the live agent stopped.

Add a read-only preflight mode to write_unraid_go_entry and invoke it before stopping existing agents:
- Validates /boot/config/go in a temporary directory without mutating /boot/config or leaving a blocking go.pulse-setup.* staging directory on pure validation refusal.
- Sets a fixed, non-secret UNRAID_GO_FAILURE_REASON describing why the boot file was rejected (for example, a custom or unrecognized Pulse Agent entry with the expected line, a prior recovery directory, or a missing trailing newline) and includes it in the error message.
- Keeps the existing agent running if /boot/config/go cannot be updated cleanly, while retaining all existing write-mode staging, verification, and recovery-preservation guarantees.

Contract-Neutral: Add read-only preflight check before stopping Unraid agents and report non-secret refusal reasons from write_unraid_go_entry without changing Unraid boot replacement admission or recovery boundaries
2026-11-28 14:20:40 +00:00

29 lines
874 B
Go

package installtests
import (
"context"
"os/exec"
"runtime"
"strings"
"testing"
"time"
)
func TestInstallSHUnraidBootReplacementPreservesUnrelatedJobs(t *testing.T) {
t.Parallel()
if runtime.GOOS == "windows" {
t.Skip("Unix shell/filesystem fixture; native Unraid acceptance remains separate")
}
ctx, cancel := context.WithTimeout(context.Background(), 45*time.Second)
defer cancel()
command := exec.CommandContext(ctx, "python3", repoFile("scripts", "installtests", "unraid_go_update.py"), "-v")
output, err := command.CombinedOutput()
if err != nil {
t.Fatalf("Unraid boot replacement controls: %v\n%s", err, output)
}
if !strings.Contains(string(output), "Ran 22 tests in ") ||
!strings.Contains(string(output), "\nOK\n") || strings.Contains(string(output), "skipped") {
t.Fatalf("incomplete Unraid boot replacement controls:\n%s", output)
}
}