Merge lp:~chipaca/ubuntu-push/bus-reorg into lp:ubuntu-push

Proposed by John Lenton
Status: Merged
Approved by: Samuele Pedroni
Approved revision: 21
Merged at revision: 24
Proposed branch: lp:~chipaca/ubuntu-push/bus-reorg
Merge into: lp:ubuntu-push
Prerequisite: lp:~chipaca/ubuntu-push/url-dispatcher
Diff against target: 228 lines (+43/-38)
6 files modified
.precommit (+29/-0)
bus/connectivity/connectivity.go (+2/-3)
bus/connectivity/connectivity_test.go (+1/-20)
bus/connectivity/example/main.go (+2/-2)
bus/connectivity/webchecker.go (+3/-3)
bus/connectivity/webchecker_test.go (+6/-10)
To merge this branch: bzr merge lp:~chipaca/ubuntu-push/bus-reorg
Reviewer Review Type Date Requested Status
Samuele Pedroni Approve
Review via email: mp+202775@code.launchpad.net

Commit message

moved a bunch of packages under bus/

Description of the change

moved a bunch of packages under bus/

bus/networkmanager/connectivity/webchecker doesn't strictly depend on
anything above it, but I consider it a helper of connectivity and not
worthy of standing alone, hence its place. Everything else is inside
that which it depends on.

To post a comment you must log in.
Revision history for this message
Samuele Pedroni (pedronis) wrote :

looks good

review: Approve
Revision history for this message
Ubuntu One Auto Pilot (otto-pilot) wrote :
Revision history for this message
Ubuntu One Auto Pilot (otto-pilot) wrote :
Revision history for this message
Ubuntu One Auto Pilot (otto-pilot) wrote :

The attempt to merge lp:~chipaca/ubuntu-push/bus-reorg into lp:ubuntu-push failed. Below is the output from the failed tests.

mkdir -p /mnt/tarmac/cache/ubuntu-push/go-ws/bin
mkdir -p /mnt/tarmac/cache/ubuntu-push/go-ws/pkg
go get -u launchpad.net/godeps
go get -d -u launchpad.net/gocheck launchpad.net/go-dbus/v1
/mnt/tarmac/cache/ubuntu-push/go-ws/bin/godeps -u dependencies.tsv
go install launchpad.net/gocheck launchpad.net/go-dbus/v1
go test launchpad.net/ubuntu-push/...
ok launchpad.net/ubuntu-push/bus 0.007s

----------------------------------------------------------------------
FAIL: connectivity_test.go:204: ConnSuite.TestRun

connectivity_test.go:243:
    c.Check(v, Equals, expected)
... obtained bool = false
... expected bool = true

connectivity_test.go:243:
    c.Check(v, Equals, expected)
... obtained bool = true
... expected bool = false

OOPS: 11 passed, 1 FAILED
--- FAIL: Test (0.11 seconds)
OK: 12 passed
FAIL
FAIL launchpad.net/ubuntu-push/bus/connectivity 0.228s
? launchpad.net/ubuntu-push/bus/connectivity/example [no test files]
ok launchpad.net/ubuntu-push/bus/networkmanager 0.031s
ok launchpad.net/ubuntu-push/bus/notifications 0.018s
ok launchpad.net/ubuntu-push/bus/testing 0.019s
ok launchpad.net/ubuntu-push/bus/urldispatcher 0.006s
ok launchpad.net/ubuntu-push/config 0.012s
ok launchpad.net/ubuntu-push/logger 0.006s
ok launchpad.net/ubuntu-push/protocol 0.010s
ok launchpad.net/ubuntu-push/server 0.024s
ok launchpad.net/ubuntu-push/server/acceptance 0.006s
? launchpad.net/ubuntu-push/server/acceptance/cmd [no test files]
ok launchpad.net/ubuntu-push/server/api 0.013s
ok launchpad.net/ubuntu-push/server/broker 0.015s
ok launchpad.net/ubuntu-push/server/broker/simple 0.015s
? launchpad.net/ubuntu-push/server/broker/testing [no test files]
? launchpad.net/ubuntu-push/server/broker/testsuite [no test files]
? launchpad.net/ubuntu-push/server/dev [no test files]
ok launchpad.net/ubuntu-push/server/listener 0.397s
ok launchpad.net/ubuntu-push/server/session 0.075s
ok launchpad.net/ubuntu-push/server/store 0.005s
? launchpad.net/ubuntu-push/testing [no test files]
ok launchpad.net/ubuntu-push/testing/condition 0.004s
ok launchpad.net/ubuntu-push/whoopsie/identifier 0.006s
ok launchpad.net/ubuntu-push/whoopsie/identifier/testing 0.014s

make: *** [check] Error 1

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file '.precommit'
2--- .precommit 1970-01-01 00:00:00 +0000
3+++ .precommit 2014-01-23 10:03:50 +0000
4@@ -0,0 +1,29 @@
5+#!/bin/sh
6+set -e
7+echo "$@"
8+# put me in the project root, call me ".precommit".
9+# And put this here-document in ~/.bazaar/plugins/precommit_script.py:
10+<<EOF
11+import os
12+import subprocess
13+from bzrlib.mutabletree import MutableTree
14+from bzrlib import errors
15+
16+def start_commit_hook(*_):
17+ """This hook will execute '.precommit' script from root path of the bazaar
18+ branch. Commit will be canceled if precommit fails."""
19+
20+ # this hook only makes sense if a precommit file exist.
21+ if not os.path.exists(".precommit"):
22+ return
23+ try:
24+ subprocess.check_call(os.path.abspath(".precommit"))
25+ # if precommit fails (process return not zero) cancel commit.
26+ except subprocess.CalledProcessError:
27+ raise errors.BzrError("pre commit check failed.")
28+
29+MutableTree.hooks.install_named_hook('start_commit', start_commit_hook,
30+ 'Run "precommit" script on start_commit')
31+EOF
32+
33+make check-format # or whatever
34
35=== renamed directory 'connectivity' => 'bus/connectivity'
36=== modified file 'bus/connectivity/connectivity.go'
37--- connectivity/connectivity.go 2014-01-20 17:44:24 +0000
38+++ bus/connectivity/connectivity.go 2014-01-23 10:03:50 +0000
39@@ -25,10 +25,9 @@
40 import (
41 "errors"
42 "launchpad.net/ubuntu-push/bus"
43+ "launchpad.net/ubuntu-push/bus/networkmanager"
44 "launchpad.net/ubuntu-push/config"
45- "launchpad.net/ubuntu-push/connectivity/webchecker"
46 "launchpad.net/ubuntu-push/logger"
47- "launchpad.net/ubuntu-push/networkmanager"
48 "time"
49 )
50
51@@ -163,7 +162,7 @@
52 // over the "out" channel. Sends "false" as soon as it detects trouble, "true"
53 // after checking actual connectivity.
54 func ConnectedState(busType bus.Bus, config Config, log logger.Logger, out chan<- bool) {
55- wg := webchecker.New(config.ConnectivityCheckURL, config.ConnectivityCheckMD5, log)
56+ wg := NewWebchecker(config.ConnectivityCheckURL, config.ConnectivityCheckMD5, log)
57 cs := &connectedState{
58 config: config,
59 log: log,
60
61=== modified file 'bus/connectivity/connectivity_test.go'
62--- connectivity/connectivity_test.go 2014-01-22 12:27:35 +0000
63+++ bus/connectivity/connectivity_test.go 2014-01-23 10:03:50 +0000
64@@ -19,12 +19,11 @@
65 import (
66 "io/ioutil"
67 . "launchpad.net/gocheck"
68+ "launchpad.net/ubuntu-push/bus/networkmanager"
69 testingbus "launchpad.net/ubuntu-push/bus/testing"
70 "launchpad.net/ubuntu-push/config"
71 "launchpad.net/ubuntu-push/logger"
72- "launchpad.net/ubuntu-push/networkmanager"
73 "launchpad.net/ubuntu-push/testing/condition"
74- "net/http"
75 "net/http/httptest"
76 "testing"
77 "time"
78@@ -201,24 +200,6 @@
79 tests for ConnectedState()
80 */
81
82-// Todo: get rid of duplication between this and webchecker_test
83-const (
84- staticText = "something ipsum dolor something"
85- staticHash = "6155f83b471583f47c99998a472a178f"
86-)
87-
88-// mkHandler makes an http.HandlerFunc that returns the provided text
89-// for whatever request it's given.
90-func mkHandler(text string) http.HandlerFunc {
91- return func(w http.ResponseWriter, r *http.Request) {
92- w.(http.Flusher).Flush()
93- w.Write([]byte(text))
94- w.(http.Flusher).Flush()
95- }
96-}
97-
98-// :oboT
99-
100 // yes, this is an integration test
101 func (s *ConnSuite) TestRun(c *C) {
102 ts := httptest.NewServer(mkHandler(staticText))
103
104=== modified file 'bus/connectivity/example/main.go'
105--- connectivity/example/main.go 2014-01-20 06:27:39 +0000
106+++ bus/connectivity/example/main.go 2014-01-23 10:03:50 +0000
107@@ -20,8 +20,8 @@
108 import (
109 "fmt"
110 "launchpad.net/ubuntu-push/bus"
111+ "launchpad.net/ubuntu-push/bus/connectivity"
112 "launchpad.net/ubuntu-push/config"
113- "launchpad.net/ubuntu-push/connectivity"
114 "launchpad.net/ubuntu-push/logger"
115 "os"
116 "strings"
117@@ -30,7 +30,7 @@
118 func main() {
119 log := logger.NewSimpleLogger(os.Stderr, "error")
120
121- paths := []string{"thing.json", "connectivity/example/thing.json"}
122+ paths := []string{"thing.json", "bus/connectivity/example/thing.json"}
123 for _, path := range paths {
124 cff, err := os.Open(path)
125 if err == nil {
126
127=== renamed file 'connectivity/webchecker/webchecker.go' => 'bus/connectivity/webchecker.go'
128--- connectivity/webchecker/webchecker.go 2014-01-20 14:58:59 +0000
129+++ bus/connectivity/webchecker.go 2014-01-23 10:03:50 +0000
130@@ -14,13 +14,13 @@
131 with this program. If not, see <http://www.gnu.org/licenses/>.
132 */
133
134-// Package webchecker checks whether we're actually connected by doing an http
135+// webchecker checks whether we're actually connected by doing an http
136 // GET to the Ubuntu connectivity check URL,
137 // http://start.ubuntu.com/connectivity-check.html
138 //
139 // We could make it be https to make extra doubly sure, but it's expensive
140 // overkill for the majority of cases.
141-package webchecker
142+package connectivity
143
144 import (
145 "crypto/md5"
146@@ -46,7 +46,7 @@
147 }
148
149 // Build a webchecker for the given URL, that should match the target MD5.
150-func New(url string, target string, log logger.Logger) Webchecker {
151+func NewWebchecker(url string, target string, log logger.Logger) Webchecker {
152 return &webchecker{log, url, target}
153 }
154
155
156=== renamed file 'connectivity/webchecker/webchecker_test.go' => 'bus/connectivity/webchecker_test.go'
157--- connectivity/webchecker/webchecker_test.go 2014-01-20 06:27:39 +0000
158+++ bus/connectivity/webchecker_test.go 2014-01-23 10:03:50 +0000
159@@ -14,26 +14,22 @@
160 with this program. If not, see <http://www.gnu.org/licenses/>.
161 */
162
163-package webchecker
164+package connectivity
165
166 import (
167- "io/ioutil"
168 . "launchpad.net/gocheck"
169- "launchpad.net/ubuntu-push/logger"
170 "net/http"
171 "net/http/httptest"
172 "testing"
173 )
174
175 // hook up gocheck
176-func Test(t *testing.T) { TestingT(t) }
177+func TestWebcheck(t *testing.T) { TestingT(t) }
178
179 type WebcheckerSuite struct{}
180
181 var _ = Suite(&WebcheckerSuite{})
182
183-var nullog = logger.NewSimpleLogger(ioutil.Discard, "error")
184-
185 const (
186 staticText = "something ipsum dolor something"
187 staticHash = "6155f83b471583f47c99998a472a178f"
188@@ -69,7 +65,7 @@
189 ts := httptest.NewServer(mkHandler(staticText))
190 defer ts.Close()
191
192- ck := New(ts.URL, staticHash, nullog)
193+ ck := NewWebchecker(ts.URL, staticHash, nullog)
194 ch := make(chan bool, 1)
195 ck.Webcheck(ch)
196 c.Check(<-ch, Equals, true)
197@@ -77,7 +73,7 @@
198
199 // Webchecker sends false if the download fails.
200 func (s *WebcheckerSuite) TestActualFails(c *C) {
201- ck := New("garbage://", "", nullog)
202+ ck := NewWebchecker("garbage://", "", nullog)
203 ch := make(chan bool, 1)
204 ck.Webcheck(ch)
205 c.Check(<-ch, Equals, false)
206@@ -88,7 +84,7 @@
207 ts := httptest.NewServer(mkHandler(""))
208 defer ts.Close()
209
210- ck := New(ts.URL, staticHash, nullog)
211+ ck := NewWebchecker(ts.URL, staticHash, nullog)
212 ch := make(chan bool, 1)
213 ck.Webcheck(ch)
214 c.Check(<-ch, Equals, false)
215@@ -99,7 +95,7 @@
216 ts := httptest.NewServer(mkHandler(bigText))
217 defer ts.Close()
218
219- ck := New(ts.URL, bigHash, nullog)
220+ ck := NewWebchecker(ts.URL, bigHash, nullog)
221 ch := make(chan bool, 1)
222 ck.Webcheck(ch)
223 c.Check(<-ch, Equals, false)
224
225=== renamed directory 'networkmanager' => 'bus/networkmanager'
226=== renamed directory 'notifications' => 'bus/notifications'
227=== renamed directory 'urldispatcher' => 'bus/urldispatcher'
228=== removed directory 'connectivity/webchecker'

Subscribers

People subscribed via source and target branches