Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 7 additions & 25 deletions dbus/subscription_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,6 @@ func TestSubscribeUnit(t *testing.T) {
t.Fatal("Couldn't start", target)
}

timeout := make(chan bool, 1)
go func() {
time.Sleep(3 * time.Second)
close(timeout)
}()

for {
select {
case changes := <-evChan:
Expand All @@ -95,7 +89,7 @@ func TestSubscribeUnit(t *testing.T) {
}
case err = <-errChan:
t.Fatal(err)
case <-timeout:
case <-time.After(10 * time.Second):
t.Fatal("Reached timeout")
}
}
Expand All @@ -114,8 +108,8 @@ func TestSubStateSubscription(t *testing.T) {
t.Fatal(err)
}

updateCh := make(chan *SubStateUpdate)
errCh := make(chan error)
updateCh := make(chan *SubStateUpdate, 256)
errCh := make(chan error, 256)
conn.SetSubStateSubscriber(updateCh, errCh)

setupUnit(target, conn, t)
Expand All @@ -132,12 +126,6 @@ func TestSubStateSubscription(t *testing.T) {
t.Fatal("Couldn't start", target)
}

timeout := make(chan bool, 1)
go func() {
time.Sleep(3 * time.Second)
close(timeout)
}()

for {
select {
case update := <-updateCh:
Expand All @@ -146,7 +134,7 @@ func TestSubStateSubscription(t *testing.T) {
}
case err := <-errCh:
t.Fatal(err)
case <-timeout:
case <-time.After(10 * time.Second):
t.Fatal("Reached timeout")
}
}
Expand All @@ -167,8 +155,8 @@ func TestPropertiesSubscription(t *testing.T) {
t.Fatal(err)
}

updateCh := make(chan *PropertiesUpdate)
errCh := make(chan error)
updateCh := make(chan *PropertiesUpdate, 256)
errCh := make(chan error, 256)
conn.SetPropertiesSubscriber(updateCh, errCh)

setupUnit(target, conn, t)
Expand All @@ -185,12 +173,6 @@ func TestPropertiesSubscription(t *testing.T) {
t.Fatal("Couldn't start", target)
}

timeout := make(chan bool, 1)
go func() {
time.Sleep(3 * time.Second)
close(timeout)
}()

for {
select {
case update := <-updateCh:
Expand All @@ -202,7 +184,7 @@ func TestPropertiesSubscription(t *testing.T) {
}
case err := <-errCh:
t.Fatal(err)
case <-timeout:
case <-time.After(10 * time.Second):
t.Fatal("Reached timeout")
}
}
Expand Down