support systemd user services (#185)

This commit is contained in:
Julius Berger
2020-06-07 20:34:08 +02:00
committed by GitHub
parent 14b2cc59a2
commit ec63d01a8d
2 changed files with 54 additions and 9 deletions
+23
View File
@@ -40,6 +40,29 @@ func TestRunInterrupt(t *testing.T) {
}
}
// Should always run, without asking for any permission
func TestUserRunInterrupt(t *testing.T) {
p := &program{}
options := make(service.KeyValue)
options["UserService"] = true
sc := &service.Config{
Name: "go_user_service_test",
Option: options,
}
s, err := service.New(p, sc)
if err != nil {
t.Fatalf("New err: %s", err)
}
err = s.Install()
if err != nil {
t.Errorf("Install err: %s", err)
}
err = s.Uninstall()
if err != nil {
t.Fatalf("Uninstall err: %s", err)
}
}
type program struct {
numStopped int
}