Merge lp:~pedronis/ubuntu-push/acceptance-extras into lp:ubuntu-push/automatic

Proposed by Samuele Pedroni
Status: Merged
Approved by: Samuele Pedroni
Approved revision: 135
Merged at revision: 137
Proposed branch: lp:~pedronis/ubuntu-push/acceptance-extras
Merge into: lp:ubuntu-push/automatic
Prerequisite: lp:~pedronis/ubuntu-push/share-session-id-w-broker
Diff against target: 60 lines (+14/-0)
2 files modified
server/acceptance/acceptanceclient.go (+5/-0)
server/acceptance/suites/suite.go (+9/-0)
To merge this branch: bzr merge lp:~pedronis/ubuntu-push/acceptance-extras
Reviewer Review Type Date Requested Status
John Lenton (community) Approve
Review via email: mp+217457@code.launchpad.net

Commit message

extras to deal with auth in acceptance tests, support receiving conn warnings as well in acceptance

Description of the change

extras to deal with auth in acceptance tests, support receiving conn warnings as well in acceptance

To post a comment you must log in.
Revision history for this message
John Lenton (chipaca) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'server/acceptance/acceptanceclient.go'
2--- server/acceptance/acceptanceclient.go 2014-04-09 19:30:53 +0000
3+++ server/acceptance/acceptanceclient.go 2014-04-28 14:38:14 +0000
4@@ -44,6 +44,7 @@
5 Levels map[string]int64
6 Insecure bool // don't verify certs
7 Prefix string // prefix for events
8+ Auth string
9 // connection
10 Connection net.Conn
11 }
12@@ -73,6 +74,7 @@
13 Type string `json:"T"`
14 protocol.BroadcastMsg
15 protocol.NotificationsMsg
16+ protocol.ConnWarnMsg
17 }
18
19 // Run the session with the server, emits a stream of events.
20@@ -93,6 +95,7 @@
21 "device": sess.Model,
22 "channel": sess.ImageChannel,
23 },
24+ Authorization: sess.Auth,
25 })
26 if err != nil {
27 return err
28@@ -136,6 +139,8 @@
29 return err
30 }
31 events <- fmt.Sprintf("%sbroadcast chan:%v app:%v topLevel:%d payloads:%s", sess.Prefix, recv.ChanId, recv.AppId, recv.TopLevel, pack)
32+ case "warn":
33+ events <- fmt.Sprintf("%swarn %s", sess.Prefix, recv.Reason)
34 }
35 }
36 return nil
37
38=== modified file 'server/acceptance/suites/suite.go'
39--- server/acceptance/suites/suite.go 2014-04-03 16:47:47 +0000
40+++ server/acceptance/suites/suite.go 2014-04-28 14:38:14 +0000
41@@ -44,10 +44,19 @@
42
43 // Start a client.
44 func (h *ServerHandle) StartClient(c *C, devId string, levels map[string]int64) (events <-chan string, errorCh <-chan error, stop func()) {
45+ return h.StartClientAuth(c, devId, levels, "")
46+}
47+
48+// Start a client with auth.
49+func (h *ServerHandle) StartClientAuth(c *C, devId string, levels map[string]int64, auth string) (events <-chan string, errorCh <-chan error, stop func()) {
50 errCh := make(chan error, 1)
51 cliEvents := make(chan string, 10)
52 sess := testClientSession(h.ServerAddr, devId, "m1", "img1", false)
53 sess.Levels = levels
54+ sess.Auth = auth
55+ if auth != "" {
56+ sess.ExchangeTimeout = 5 * time.Second
57+ }
58 err := sess.Dial()
59 c.Assert(err, IsNil)
60 clientShutdown := make(chan bool, 1) // abused as an atomic flag

Subscribers

People subscribed via source and target branches