~artmello/ubuntu-push/ubuntu-push-fix_1611848

« back to all changes in this revision

Viewing changes to bus/testing/testing_endpoint_test.go

  • Committer: CI Train Bot
  • Author(s): Ricardo Salveti de Araujo
  • Date: 2015-04-30 15:08:54 UTC
  • mfrom: (145.1.2 ubuntu-push)
  • Revision ID: ci-train-bot@canonical.com-20150430150854-2u38lu0oi8rtomo1
[ Samuele Pedroni ]
* switch poller to use killswitch state for WLAN instead of misleading NM property (LP: #1446584)
* don't have goroutines from a previous test overlap with the next, races gets detected otherwise
* have the TestDialWorksDirect* tests quickly timeout, go1.3 wants a ServerName set in the tls config for them to work
* fix flaky test
* support sha384/512 certs, some exercizing of that
* let send a build number with acceptanceclient
* add helper to get int out of ConnectMsg Info
Approved by: Samuele Pedroni

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
        "testing"
21
21
        "time"
22
22
 
 
23
        "launchpad.net/go-dbus/v1"
23
24
        . "launchpad.net/gocheck"
24
25
 
25
26
        "launchpad.net/ubuntu-push/bus"
203
204
        c.Check(e, NotNil)
204
205
}
205
206
 
 
207
// Test that WatchProperties() with a positive condition sends the
 
208
// provided return values over the channel.
 
209
func (s *TestingEndpointSuite) TestWatchProperties(c *C) {
 
210
        var m, n int32 = 42, 17
 
211
        endp := NewMultiValuedTestingEndpoint(nil, condition.Work(true),
 
212
                []interface{}{map[string]dbus.Variant{"s": dbus.Variant{m}}, []string{}},
 
213
                []interface{}{map[string]dbus.Variant{"s": dbus.Variant{n}}, []string{}},
 
214
        )
 
215
        ch := make(chan int32)
 
216
        w, e := endp.WatchProperties(func(changed map[string]dbus.Variant, nvalited []string) {
 
217
                ch <- changed["s"].Value.(int32)
 
218
        }, func() { close(ch) })
 
219
        c.Assert(e, IsNil)
 
220
        defer w.Cancel()
 
221
        c.Check(<-ch, Equals, m)
 
222
        c.Check(<-ch, Equals, n)
 
223
}
 
224
 
206
225
// Test Dial() with a non-working bus fails
207
226
func (s *TestingBusSuite) TestDialNoWork(c *C) {
208
227
        endp := NewTestingEndpoint(condition.Work(false), nil)