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.

502 B
Raw Blame
//go:build !windows

package agentupdate

import (
	"errors"
	"testing"
)

func TestRestartProcess(t *testing.T) {
	orig := execFn
	t.Cleanup(func() { execFn = orig })

	execFn = func(string, []string, []string) error { return nil }
	if err := restartProcess("/bin/true"); err != nil {
		t.Fatalf("expected nil error, got %v", err)
	}

	execFn = func(string, []string, []string) error { return errors.New("boom") }
	if err := restartProcess("/bin/false"); err == nil {
		t.Fatal("expected error")
	}
}