Ubuntu Pastebin

Paste from jameinel at Wed, 11 Mar 2015 15:04:54 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/featuretests/leadership_test.go b/featuretests/leadership_test.go
index dcb4a32..16165e6 100644
--- a/featuretests/leadership_test.go
+++ b/featuretests/leadership_test.go
@@ -268,7 +268,15 @@ func (s *uniterLeadershipSuite) TestSettingsChangeNotifier(c *gc.C) {
 	go func() {
 		watcher, err := client.LeadershipSettings.WatchLeadershipSettings(s.serviceId)
 		c.Assert(err, gc.IsNil)
-		sawChanges <- <-watcher.Changes()
+		// Ignore the initial event
+		<-watcher.Changes()
+		if change, ok := <-watcher.Changes(); ok {
+			sawChanges <- change
+		} else {
+			// send a message anyway so the test doesn't hang
+			sawChanges <-change
+			c.Fatalf("watcher failed to send a change: %s", watcher.Err())
+		}
 	}()
 
 	err = client.LeadershipSettings.Merge(s.serviceId, map[string]string{"foo": "bar"})
Download as text