Merge lp:~jonas-drange/ubuntu-push/lp1554547-automatic into lp:ubuntu-push/automatic

Proposed by Jonas G. Drange on 2016-03-09
Status: Merged
Approved by: Jonas G. Drange on 2016-03-10
Approved revision: 424
Merged at revision: 424
Proposed branch: lp:~jonas-drange/ubuntu-push/lp1554547-automatic
Merge into: lp:ubuntu-push/automatic
Diff against target: 163 lines (+76/-16)
4 files modified
bus/systemimage/systemimage.go (+41/-6)
bus/systemimage/systemimage_test.go (+24/-8)
client/client.go (+1/-1)
client/client_test.go (+10/-1)
To merge this branch: bzr merge lp:~jonas-drange/ubuntu-push/lp1554547-automatic
Reviewer Review Type Date Requested Status
Jonas G. Drange (community) Approve on 2016-03-09
Review via email: mp+288535@code.launchpad.net

Commit message

deprecate the usage of Info and replace it with Information

To post a comment you must log in.
review: Approve
Ubuntu One Auto Pilot (otto-pilot) wrote :
Download full text (43.9 KiB)

The attempt to merge lp:~jonas-drange/ubuntu-push/lp1554547-automatic into lp:ubuntu-push/automatic failed. Below is the output from the failed tests.

scripts/deps.sh server/dev/server.go
scripts/deps.sh server/acceptance/cmd/acceptanceclient.go
scripts/deps.sh ubuntu-push-client.go
/mnt/tarmac/cache/ubuntu-push-automatic/go-ws/bin/godeps -t launchpad.net/ubuntu-push launchpad.net/ubuntu-push/accounts launchpad.net/ubuntu-push/bus launchpad.net/ubuntu-push/bus/accounts launchpad.net/ubuntu-push/bus/connectivity launchpad.net/ubuntu-push/bus/emblemcounter launchpad.net/ubuntu-push/bus/haptic launchpad.net/ubuntu-push/bus/networkmanager launchpad.net/ubuntu-push/bus/notifications launchpad.net/ubuntu-push/bus/polld launchpad.net/ubuntu-push/bus/powerd launchpad.net/ubuntu-push/bus/systemimage launchpad.net/ubuntu-push/bus/testing launchpad.net/ubuntu-push/bus/unitygreeter launchpad.net/ubuntu-push/bus/urfkill launchpad.net/ubuntu-push/bus/windowstack launchpad.net/ubuntu-push/click launchpad.net/ubuntu-push/click/cappinfo launchpad.net/ubuntu-push/click/cblacklist launchpad.net/ubuntu-push/click/cclick launchpad.net/ubuntu-push/click/testing launchpad.net/ubuntu-push/client launchpad.net/ubuntu-push/client/gethosts launchpad.net/ubuntu-push/client/service launchpad.net/ubuntu-push/client/session launchpad.net/ubuntu-push/client/session/seenstate launchpad.net/ubuntu-push/config launchpad.net/ubuntu-push/external/murmur3 launchpad.net/ubuntu-push/identifier launchpad.net/ubuntu-push/identifier/testing launchpad.net/ubuntu-push/launch_helper launchpad.net/ubuntu-push/launch_helper/cual launchpad.net/ubuntu-push/launch_helper/helper_finder launchpad.net/ubuntu-push/launch_helper/legacy launchpad.net/ubuntu-push/logger launchpad.net/ubuntu-push/messaging launchpad.net/ubuntu-push/messaging/cmessaging launchpad.net/ubuntu-push/messaging/reply launchpad.net/ubuntu-push/nih launchpad.net/ubuntu-push/nih/cnih launchpad.net/ubuntu-push/poller launchpad.net/ubuntu-push/protocol launchpad.net/ubuntu-push/server launchpad.net/ubuntu-push/server/api launchpad.net/ubuntu-push/server/broker launchpad.net/ubuntu-push/server/broker/simple launchpad.net/ubuntu-push/server/broker/testing launchpad.net/ubuntu-push/server/broker/testsuite launchpad.net/ubuntu-push/server/dev launchpad.net/ubuntu-push/server/listener launchpad.net/ubuntu-push/server/session launchpad.net/ubuntu-push/server/store launchpad.net/ubuntu-push/sounds launchpad.net/ubuntu-push/testing launchpad.net/ubuntu-push/testing/condition launchpad.net/ubuntu-push/urldispatcher launchpad.net/ubuntu-push/urldispatcher/curldispatcher launchpad.net/ubuntu-push/util launchpad.net/ubuntu-push/ launchpad.net/ubuntu-push/server/acceptance/cmd/ launchpad.net/ubuntu-push/server/dev/ 2>/dev/null | cat > dependencies.tsv
rm -f -r /mnt/tarmac/cache/ubuntu-push-automatic/go-ws/pkg
mkdir -p /mnt/tarmac/cache/ubuntu-push-automatic/go-ws/bin
mkdir -p /mnt/tarmac/cache/ubuntu-push-automatic/go-ws/pkg
go get -u launchpad.net/godeps
go get -d -u launchpad.net/gocheck launchpad.net/go-dbus/v1 launchpad.net/go-xdg/v0 code.google.com/p/gosqlite/sqlite3 code.google.com/p/go-uuid/uuid
/mnt/tarmac/cache/ubuntu-push-automati...

Ubuntu One Auto Pilot (otto-pilot) wrote :
Download full text (43.5 KiB)

The attempt to merge lp:~jonas-drange/ubuntu-push/lp1554547-automatic into lp:ubuntu-push/automatic failed. Below is the output from the failed tests.

scripts/deps.sh server/dev/server.go
scripts/deps.sh server/acceptance/cmd/acceptanceclient.go
scripts/deps.sh ubuntu-push-client.go
/mnt/tarmac/cache/ubuntu-push-automatic/go-ws/bin/godeps -t launchpad.net/ubuntu-push launchpad.net/ubuntu-push/accounts launchpad.net/ubuntu-push/bus launchpad.net/ubuntu-push/bus/accounts launchpad.net/ubuntu-push/bus/connectivity launchpad.net/ubuntu-push/bus/emblemcounter launchpad.net/ubuntu-push/bus/haptic launchpad.net/ubuntu-push/bus/networkmanager launchpad.net/ubuntu-push/bus/notifications launchpad.net/ubuntu-push/bus/polld launchpad.net/ubuntu-push/bus/powerd launchpad.net/ubuntu-push/bus/systemimage launchpad.net/ubuntu-push/bus/testing launchpad.net/ubuntu-push/bus/unitygreeter launchpad.net/ubuntu-push/bus/urfkill launchpad.net/ubuntu-push/bus/windowstack launchpad.net/ubuntu-push/click launchpad.net/ubuntu-push/click/cappinfo launchpad.net/ubuntu-push/click/cblacklist launchpad.net/ubuntu-push/click/cclick launchpad.net/ubuntu-push/click/testing launchpad.net/ubuntu-push/client launchpad.net/ubuntu-push/client/gethosts launchpad.net/ubuntu-push/client/service launchpad.net/ubuntu-push/client/session launchpad.net/ubuntu-push/client/session/seenstate launchpad.net/ubuntu-push/config launchpad.net/ubuntu-push/external/murmur3 launchpad.net/ubuntu-push/identifier launchpad.net/ubuntu-push/identifier/testing launchpad.net/ubuntu-push/launch_helper launchpad.net/ubuntu-push/launch_helper/cual launchpad.net/ubuntu-push/launch_helper/helper_finder launchpad.net/ubuntu-push/launch_helper/legacy launchpad.net/ubuntu-push/logger launchpad.net/ubuntu-push/messaging launchpad.net/ubuntu-push/messaging/cmessaging launchpad.net/ubuntu-push/messaging/reply launchpad.net/ubuntu-push/nih launchpad.net/ubuntu-push/nih/cnih launchpad.net/ubuntu-push/poller launchpad.net/ubuntu-push/protocol launchpad.net/ubuntu-push/server launchpad.net/ubuntu-push/server/api launchpad.net/ubuntu-push/server/broker launchpad.net/ubuntu-push/server/broker/simple launchpad.net/ubuntu-push/server/broker/testing launchpad.net/ubuntu-push/server/broker/testsuite launchpad.net/ubuntu-push/server/dev launchpad.net/ubuntu-push/server/listener launchpad.net/ubuntu-push/server/session launchpad.net/ubuntu-push/server/store launchpad.net/ubuntu-push/sounds launchpad.net/ubuntu-push/testing launchpad.net/ubuntu-push/testing/condition launchpad.net/ubuntu-push/urldispatcher launchpad.net/ubuntu-push/urldispatcher/curldispatcher launchpad.net/ubuntu-push/util launchpad.net/ubuntu-push/ launchpad.net/ubuntu-push/server/acceptance/cmd/ launchpad.net/ubuntu-push/server/dev/ 2>/dev/null | cat > dependencies.tsv
rm -f -r /mnt/tarmac/cache/ubuntu-push-automatic/go-ws/pkg
mkdir -p /mnt/tarmac/cache/ubuntu-push-automatic/go-ws/bin
mkdir -p /mnt/tarmac/cache/ubuntu-push-automatic/go-ws/pkg
go get -u launchpad.net/godeps
go get -d -u launchpad.net/gocheck launchpad.net/go-dbus/v1 launchpad.net/go-xdg/v0 code.google.com/p/gosqlite/sqlite3 code.google.com/p/go-uuid/uuid
/mnt/tarmac/cache/ubuntu-push-automati...

424. By Jonas G. Drange on 2016-03-10

fix broken tests

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bus/systemimage/systemimage.go'
2--- bus/systemimage/systemimage.go 2015-01-21 17:21:42 +0000
3+++ bus/systemimage/systemimage.go 2016-03-10 13:15:52 +0000
4@@ -18,6 +18,9 @@
5 package systemimage
6
7 import (
8+ "strconv"
9+ "strings"
10+
11 "launchpad.net/ubuntu-push/bus"
12 "launchpad.net/ubuntu-push/logger"
13 )
14@@ -37,11 +40,12 @@
15 // xxx channel_target missing
16 LastUpdate string
17 VersionDetail map[string]string
18+ Raw map[string]string
19 }
20
21 // A SystemImage exposes the a subset of system-image service.
22 type SystemImage interface {
23- Info() (*InfoResult, error)
24+ Information() (*InfoResult, error)
25 }
26
27 type systemImage struct {
28@@ -56,13 +60,44 @@
29
30 var _ SystemImage = &systemImage{} // ensures it conforms
31
32-func (si *systemImage) Info() (*InfoResult, error) {
33- si.log.Debugf("invoking Info")
34- res := &InfoResult{}
35- err := si.endp.Call("Info", bus.Args(), &res.BuildNumber, &res.Device, &res.Channel, &res.LastUpdate, &res.VersionDetail)
36+func (si *systemImage) Information() (*InfoResult, error) {
37+ si.log.Debugf("invoking Information")
38+ m := map[string]string{}
39+ err := si.endp.Call("Information", bus.Args(), &m)
40+
41 if err != nil {
42- si.log.Errorf("Info failed: %v", err)
43+ si.log.Errorf("Information failed: %v", err)
44 return nil, err
45 }
46+
47+ res := &InfoResult{}
48+
49+ // Try parsing the build number if it exist.
50+ if bn := m["current_build_number"]; len(bn) > 0 {
51+ bn, err := strconv.ParseInt(bn, 10, 32)
52+ if err == nil {
53+ res.BuildNumber = int32(bn)
54+ } else {
55+ res.BuildNumber = -1
56+ }
57+ }
58+
59+ res.Device = m["device_name"]
60+ res.Channel = m["channel_name"]
61+ res.LastUpdate = m["last_update_date"]
62+ res.VersionDetail = map[string]string{}
63+
64+ // Split version detail key=value,key2=value2 into a string map
65+ // Note that even if
66+ vals := strings.Split(m["version_detail"], ",")
67+ for _, val := range vals {
68+ pairs := strings.Split(val, "=")
69+ if len(pairs) != 2 {
70+ continue
71+ }
72+ res.VersionDetail[pairs[0]] = pairs[1]
73+ }
74+ res.Raw = m
75+
76 return res, err
77 }
78
79=== modified file 'bus/systemimage/systemimage_test.go'
80--- bus/systemimage/systemimage_test.go 2014-04-02 08:46:48 +0000
81+++ bus/systemimage/systemimage_test.go 2016-03-10 13:15:52 +0000
82@@ -41,22 +41,38 @@
83 }
84
85 func (s *SISuite) TestWorks(c *C) {
86- endp := testibus.NewMultiValuedTestingEndpoint(nil, condition.Work(true), []interface{}{int32(101), "mako", "daily", "Unknown", map[string]string{}})
87+ m := map[string]string{
88+ "version_detail": "ubuntu=20160304.2,device=20160304.2,custom=20160304.2,version=381",
89+ "last_update_date": "2016-03-04 15:25:31",
90+ "last_check_date": "2016-03-08 04:30:34",
91+ "target_version_detail": "-1",
92+ "device_name": "mako",
93+ "target_build_number": "-1",
94+ "channel_name": "ubuntu-touch/rc-proposed/ubuntu",
95+ "current_build_number": "381",
96+ }
97+ endp := testibus.NewMultiValuedTestingEndpoint(nil, condition.Work(true), []interface{}{m})
98 si := New(endp, s.log)
99- res, err := si.Info()
100+ res, err := si.Information()
101 c.Assert(err, IsNil)
102 c.Check(res, DeepEquals, &InfoResult{
103- BuildNumber: 101,
104- Device: "mako",
105- Channel: "daily",
106- LastUpdate: "Unknown",
107- VersionDetail: map[string]string{},
108+ BuildNumber: 381,
109+ Device: "mako",
110+ Channel: "ubuntu-touch/rc-proposed/ubuntu",
111+ LastUpdate: "2016-03-04 15:25:31",
112+ VersionDetail: map[string]string{
113+ "ubuntu": "20160304.2",
114+ "device": "20160304.2",
115+ "custom": "20160304.2",
116+ "version": "381",
117+ },
118+ Raw: m,
119 })
120 }
121
122 func (s *SISuite) TestFailsIfCallFails(c *C) {
123 endp := testibus.NewTestingEndpoint(nil, condition.Work(false))
124 si := New(endp, s.log)
125- _, err := si.Info()
126+ _, err := si.Information()
127 c.Check(err, NotNil)
128 }
129
130=== modified file 'client/client.go'
131--- client/client.go 2015-09-30 14:44:14 +0000
132+++ client/client.go 2016-03-10 13:15:52 +0000
133@@ -292,7 +292,7 @@
134 go cs.Track(client.connCh)
135 util.NewAutoRedialer(client.systemImageEndp).Redial()
136 sysimg := systemimage.New(client.systemImageEndp, client.log)
137- info, err := sysimg.Info()
138+ info, err := sysimg.Information()
139 if err != nil {
140 return err
141 }
142
143=== modified file 'client/client_test.go'
144--- client/client_test.go 2015-10-01 20:16:49 +0000
145+++ client/client_test.go 2016-03-10 13:15:52 +0000
146@@ -674,7 +674,16 @@
147 dbus.ObjectPath("hello"),
148 )
149 siCond := condition.Fail2Work(2)
150- siEndp := testibus.NewMultiValuedTestingEndpoint(siCond, condition.Work(true), []interface{}{int32(101), "mako", "daily", "Unknown", map[string]string{}})
151+ siEndp := testibus.NewMultiValuedTestingEndpoint(siCond, condition.Work(true), []interface{}{map[string]string{
152+ "version_detail": "ubuntu=20160304.2,device=20160304.2,custom=20160304.2,version=381",
153+ "last_update_date": "2016-03-04 15:25:31",
154+ "last_check_date": "2016-03-08 04:30:34",
155+ "target_version_detail": "-1",
156+ "device_name": "mako",
157+ "target_build_number": "-1",
158+ "channel_name": "ubuntu-touch/rc-proposed/ubuntu",
159+ "current_build_number": "381",
160+ }})
161 tickerCh := make(chan []interface{})
162 nopTickerCh := make(chan []interface{})
163 testibus.SetWatchSource(cEndp, "StateChanged", tickerCh)

Subscribers

People subscribed via source and target branches