package main import ( "os" "os/exec" "strings" "testing" ) // Run on a real machine with MESH_LIVE=1: logind gives this account a delay lock, and it shows. func TestLiveLogindGivesADelayLock(t *testing.T) { if os.Getenv("MESH_LIVE") == "" { t.Skip("set MESH_LIVE=1 on a machine with logind") } l, err := DialLogin1() if err != nil { t.Fatal(err) } defer l.Close() f, err := l.Inhibit("sleep:shutdown", "mesh power", "live test") if err != nil { t.Fatal(err) } out, _ := exec.Command("systemd-inhibit", "--list", "--no-pager").CombinedOutput() if !strings.Contains(string(out), "mesh power") { t.Fatalf("not listed:\n%s", out) } t.Logf("%s", out) f.Close() }