mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-12-03 18:43:38 +01:00
24 lines
502 B
Go
24 lines
502 B
Go
//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")
|
|
}
|
|
}
|