8
// TestSubscribeUnit exercises the basics of subscription of a particular unit.
9
func TestSubscriptionSetUnit(t *testing.T) {
10
target := "subscribe-events-set.service"
18
err = conn.Subscribe()
23
subSet := conn.NewSubscriptionSet()
24
evChan, errChan := subSet.Subscribe()
27
setupUnit(target, conn, t)
29
job, err := conn.StartUnit(target, "replace")
35
t.Fatal("Couldn't start", target)
38
timeout := make(chan bool, 1)
40
time.Sleep(3 * time.Second)
46
case changes := <-evChan:
47
tCh, ok := changes[target]
50
t.Fatal("Unexpected event %v", changes)
53
if tCh.ActiveState == "active" && tCh.Name == target {
59
t.Fatal("Reached timeout")