Merge lp:~pedronis/ubuntu-push/server-bits-in-server into lp:ubuntu-push

Proposed by Samuele Pedroni
Status: Merged
Approved by: Samuele Pedroni
Approved revision: 20
Merged at revision: 19
Proposed branch: lp:~pedronis/ubuntu-push/server-bits-in-server
Merge into: lp:ubuntu-push
Diff against target: 187 lines (+41/-19)
9 files modified
server/acceptance/acceptance.sh (+5/-3)
server/bootlog.go (+5/-4)
server/bootlog_test.go (+1/-1)
server/config_test.go (+1/-1)
server/dev/server.go (+7/-6)
server/doc.go (+18/-0)
server/runner_devices.go (+2/-2)
server/runner_http.go (+1/-1)
server/runner_test.go (+1/-1)
To merge this branch: bzr merge lp:~pedronis/ubuntu-push/server-bits-in-server
Reviewer Review Type Date Requested Status
John Lenton (community) Approve
Review via email: mp+202999@code.launchpad.net

Commit message

populate /server with the runners code; generalize acceptance.sh

Description of the change

* populate /server with the runners code

* generalize acceptance.sh

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

Easy peasy review. Good job.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'server/acceptance/acceptance.sh'
2--- server/acceptance/acceptance.sh 2014-01-14 15:35:20 +0000
3+++ server/acceptance/acceptance.sh 2014-01-24 07:55:11 +0000
4@@ -1,6 +1,8 @@
5 # run acceptance tests, expects properly setup GOPATH and deps
6 # can set extra build params like -race with BUILD_FLAGS envvar
7+# can set server pkg name with SERVER_PKG
8 set -ex
9-go test $BUILD_FLAGS -i
10-go build $BUILD_FLAGS -o testserver launchpad.net/ubuntu-push/server/dev
11-go test $BUILD_FLAGS -server ./testserver $*
12+SERVER_PKG=${SERVER_PKG:-launchpad.net/ubuntu-push/server/dev}
13+go test $BUILD_FLAGS -i launchpad.net/ubuntu-push/server/acceptance
14+go build $BUILD_FLAGS -o testserver ${SERVER_PKG}
15+go test $BUILD_FLAGS launchpad.net/ubuntu-push/server/acceptance -server ${PWD}/testserver $*
16
17=== renamed file 'server/dev/bootlog.go' => 'server/bootlog.go'
18--- server/dev/bootlog.go 2014-01-22 09:50:45 +0000
19+++ server/bootlog.go 2014-01-24 07:55:11 +0000
20@@ -14,7 +14,7 @@
21 with this program. If not, see <http://www.gnu.org/licenses/>.
22 */
23
24-package main
25+package server
26
27 import (
28 "launchpad.net/ubuntu-push/logger"
29@@ -29,7 +29,8 @@
30 }
31
32 var (
33- BootLogger = logger.NewSimpleLogger(os.Stderr, "debug")
34- BootLogListener = bootLogListener
35- BootLogFatalf = BootLogger.Fatalf
36+ BootLogger = logger.NewSimpleLogger(os.Stderr, "debug")
37+ // Boot logging helpers through BootLogger.
38+ BootLogListener func(kind string, lst net.Listener) = bootLogListener
39+ BootLogFatalf = BootLogger.Fatalf
40 )
41
42=== renamed file 'server/dev/bootlog_test.go' => 'server/bootlog_test.go'
43--- server/dev/bootlog_test.go 2014-01-22 09:50:45 +0000
44+++ server/bootlog_test.go 2014-01-24 07:55:11 +0000
45@@ -14,7 +14,7 @@
46 with this program. If not, see <http://www.gnu.org/licenses/>.
47 */
48
49-package main
50+package server
51
52 import (
53 "bytes"
54
55=== renamed file 'server/dev/config_test.go' => 'server/config_test.go'
56--- server/dev/config_test.go 2014-01-22 09:50:45 +0000
57+++ server/config_test.go 2014-01-24 07:55:11 +0000
58@@ -14,7 +14,7 @@
59 with this program. If not, see <http://www.gnu.org/licenses/>.
60 */
61
62-package main
63+package server
64
65 import (
66 "bytes"
67
68=== modified file 'server/dev/server.go'
69--- server/dev/server.go 2014-01-22 09:50:45 +0000
70+++ server/dev/server.go 2014-01-24 07:55:11 +0000
71@@ -20,6 +20,7 @@
72 import (
73 "launchpad.net/ubuntu-push/config"
74 "launchpad.net/ubuntu-push/logger"
75+ "launchpad.net/ubuntu-push/server"
76 "launchpad.net/ubuntu-push/server/api"
77 "launchpad.net/ubuntu-push/server/broker"
78 "launchpad.net/ubuntu-push/server/session"
79@@ -31,9 +32,9 @@
80
81 type configuration struct {
82 // device server configuration
83- DevicesParsedConfig
84+ server.DevicesParsedConfig
85 // api http server configuration
86- HTTPServeParsedConfig
87+ server.HTTPServeParsedConfig
88 }
89
90 func main() {
91@@ -41,11 +42,11 @@
92 cfg := &configuration{}
93 err := config.ReadFiles(cfg, cfgFpaths...)
94 if err != nil {
95- BootLogFatalf("reading config: %v", err)
96+ server.BootLogFatalf("reading config: %v", err)
97 }
98 err = cfg.DevicesParsedConfig.FinishLoad(filepath.Dir(cfgFpaths[len(cfgFpaths)-1]))
99 if err != nil {
100- BootLogFatalf("reading config: %v", err)
101+ server.BootLogFatalf("reading config: %v", err)
102 }
103 logger := logger.NewSimpleLogger(os.Stderr, "debug")
104 // setup a pending store and start the broker
105@@ -56,9 +57,9 @@
106 // serve the http api
107 handler := api.MakeHandlersMux(sto, broker, logger)
108 handler = api.PanicTo500Handler(handler, logger)
109- go HTTPServeRunner(handler, &cfg.HTTPServeParsedConfig)()
110+ go server.HTTPServeRunner(handler, &cfg.HTTPServeParsedConfig)()
111 // listen for device connections
112- DevicesRunner(func(conn net.Conn) error {
113+ server.DevicesRunner(func(conn net.Conn) error {
114 track := session.NewTracker(logger)
115 return session.Session(conn, broker, cfg, track)
116 }, logger, &cfg.DevicesParsedConfig)()
117
118=== added file 'server/doc.go'
119--- server/doc.go 1970-01-01 00:00:00 +0000
120+++ server/doc.go 2014-01-24 07:55:11 +0000
121@@ -0,0 +1,18 @@
122+/*
123+ Copyright 2013-2014 Canonical Ltd.
124+
125+ This program is free software: you can redistribute it and/or modify it
126+ under the terms of the GNU General Public License version 3, as published
127+ by the Free Software Foundation.
128+
129+ This program is distributed in the hope that it will be useful, but
130+ WITHOUT ANY WARRANTY; without even the implied warranties of
131+ MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
132+ PURPOSE. See the GNU General Public License for more details.
133+
134+ You should have received a copy of the GNU General Public License along
135+ with this program. If not, see <http://www.gnu.org/licenses/>.
136+*/
137+
138+// Package server contains code to start server components hosted by the subpackages.
139+package server
140
141=== renamed file 'server/dev/runner_devices.go' => 'server/runner_devices.go'
142--- server/dev/runner_devices.go 2014-01-22 09:50:45 +0000
143+++ server/runner_devices.go 2014-01-24 07:55:11 +0000
144@@ -14,7 +14,7 @@
145 with this program. If not, see <http://www.gnu.org/licenses/>.
146 */
147
148-package main
149+package server
150
151 import (
152 "fmt"
153@@ -85,7 +85,7 @@
154 return cfg.certPEMBlock
155 }
156
157-// RunDevices listens for device connections.
158+// DevicesRunner returns a function to accept device connections.
159 func DevicesRunner(session func(net.Conn) error, logger logger.Logger, parsedCfg *DevicesParsedConfig) func() {
160 BootLogger.Debugf("PingInterval: %s, ExchangeTimeout %s", parsedCfg.PingInterval(), parsedCfg.ExchangeTimeout())
161 var rlim syscall.Rlimit
162
163=== renamed file 'server/dev/runner_http.go' => 'server/runner_http.go'
164--- server/dev/runner_http.go 2014-01-22 09:50:45 +0000
165+++ server/runner_http.go 2014-01-24 07:55:11 +0000
166@@ -14,7 +14,7 @@
167 with this program. If not, see <http://www.gnu.org/licenses/>.
168 */
169
170-package main
171+package server
172
173 import (
174 "launchpad.net/ubuntu-push/config"
175
176=== renamed file 'server/dev/runner_test.go' => 'server/runner_test.go'
177--- server/dev/runner_test.go 2014-01-22 09:50:45 +0000
178+++ server/runner_test.go 2014-01-24 07:55:11 +0000
179@@ -14,7 +14,7 @@
180 with this program. If not, see <http://www.gnu.org/licenses/>.
181 */
182
183-package main
184+package server
185
186 import (
187 "bytes"

Subscribers

People subscribed via source and target branches