Merge lp:~allenap/maas/oops-did-it-again into lp:~maas-committers/maas/trunk
- oops-did-it-again
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Gavin Panella |
Approved revision: | no longer in the source branch. |
Merged at revision: | 3457 |
Proposed branch: | lp:~allenap/maas/oops-did-it-again |
Merge into: | lp:~maas-committers/maas/trunk |
Diff against target: |
397 lines (+11/-201) 12 files modified
docs/development/cluster-bootstrap.rst (+1/-1) etc/maas/pserv.yaml (+0/-11) required-packages/base (+1/-5) setup.py (+0/-3) src/maas/settings.py (+0/-3) src/maasserver/management/commands/runserver.py (+0/-45) src/maasserver/tests/test_runserver.py (+0/-38) src/provisioningserver/config.py (+6/-1) src/provisioningserver/plugin.py (+1/-54) src/provisioningserver/tests/test_config.py (+0/-2) src/provisioningserver/tests/test_plugin.py (+1/-1) src/provisioningserver/tests/test_plugin_services.py (+1/-37) |
To merge this branch: | bzr merge lp:~allenap/maas/oops-did-it-again |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Blake Rouse (community) | Approve | ||
Review via email: mp+246463@code.launchpad.net |
Commit message
Remove all OOPS reporting.
Description of the change
MAAS Lander (maas-lander) wrote : | # |
The attempt to merge lp:~allenap/maas/oops-did-it-again into lp:maas failed. Below is the output from the failed tests.
Ign http://
Get:1 http://
Ign http://
Get:2 http://
Ign http://
Hit http://
Get:3 http://
Hit http://
Get:4 http://
Get:5 http://
Hit http://
Get:6 http://
Get:7 http://
Get:8 http://
Hit http://
Hit http://
Hit http://
Hit http://
Hit http://
Hit http://
Hit http://
Get:9 http://
Get:10 http://
Get:11 http://
Get:12 http://
Get:13 http://
Hit http://
Ign http://
Ign http://
Fetched 1,556 kB in 3s (509 kB/s)
Reading package lists...
sudo DEBIAN_
--
Gavin Panella (allenap) wrote : | # |
Unrelated failure :-/
Preview Diff
1 | === modified file 'docs/development/cluster-bootstrap.rst' | |||
2 | --- docs/development/cluster-bootstrap.rst 2014-10-09 21:53:36 +0000 | |||
3 | +++ docs/development/cluster-bootstrap.rst 2015-01-14 16:31:22 +0000 | |||
4 | @@ -29,7 +29,7 @@ | |||
5 | 29 | 29 | ||
6 | 30 | #. ``ClusterClientService`` starts. | 30 | #. ``ClusterClientService`` starts. |
7 | 31 | 31 | ||
9 | 32 | #. Services other than log and oops are **not** started. | 32 | #. Services other than ``log`` are **not** started. |
10 | 33 | 33 | ||
11 | 34 | #. Wait for a connection to the region to become available. | 34 | #. Wait for a connection to the region to become available. |
12 | 35 | 35 | ||
13 | 36 | 36 | ||
14 | === modified file 'etc/maas/pserv.yaml' | |||
15 | --- etc/maas/pserv.yaml 2014-08-13 21:49:35 +0000 | |||
16 | +++ etc/maas/pserv.yaml 2015-01-14 16:31:22 +0000 | |||
17 | @@ -8,17 +8,6 @@ | |||
18 | 8 | # logfile: "pserv.log" | 8 | # logfile: "pserv.log" |
19 | 9 | logfile: "/dev/null" | 9 | logfile: "/dev/null" |
20 | 10 | 10 | ||
21 | 11 | ## OOPS configuration (optional). | ||
22 | 12 | # | ||
23 | 13 | oops: | ||
24 | 14 | ## Directory in which to place OOPS reports. Must not contain any files | ||
25 | 15 | # or directories other than what the oops machinery creates there. | ||
26 | 16 | # | ||
27 | 17 | # directory: | ||
28 | 18 | directory: "logs/oops" | ||
29 | 19 | # reporter: | ||
30 | 20 | reporter: "maas-pserv" | ||
31 | 21 | |||
32 | 22 | ## TFTP configuration. | 11 | ## TFTP configuration. |
33 | 23 | # | 12 | # |
34 | 24 | tftp: | 13 | tftp: |
35 | 25 | 14 | ||
36 | === modified file 'required-packages/base' | |||
37 | --- required-packages/base 2014-11-14 17:44:54 +0000 | |||
38 | +++ required-packages/base 2015-01-14 16:31:22 +0000 | |||
39 | @@ -12,6 +12,7 @@ | |||
40 | 12 | libpq-dev | 12 | libpq-dev |
41 | 13 | postgresql | 13 | postgresql |
42 | 14 | python-amqplib | 14 | python-amqplib |
43 | 15 | python-bson | ||
44 | 15 | python-bzrlib | 16 | python-bzrlib |
45 | 16 | python-convoy | 17 | python-convoy |
46 | 17 | python-crochet | 18 | python-crochet |
47 | @@ -31,11 +32,6 @@ | |||
48 | 31 | python-netaddr | 32 | python-netaddr |
49 | 32 | python-netifaces | 33 | python-netifaces |
50 | 33 | python-oauth | 34 | python-oauth |
51 | 34 | python-oops | ||
52 | 35 | python-oops-amqp | ||
53 | 36 | python-oops-datedir-repo | ||
54 | 37 | python-oops-twisted | ||
55 | 38 | python-oops-wsgi | ||
56 | 39 | python-openssl | 35 | python-openssl |
57 | 40 | python-paramiko | 36 | python-paramiko |
58 | 41 | python-pexpect | 37 | python-pexpect |
59 | 42 | 38 | ||
60 | === modified file 'setup.py' | |||
61 | --- setup.py 2014-09-29 15:26:08 +0000 | |||
62 | +++ setup.py 2015-01-14 16:31:22 +0000 | |||
63 | @@ -125,9 +125,6 @@ | |||
64 | 125 | 'django-piston', | 125 | 'django-piston', |
65 | 126 | 'FormEncode', | 126 | 'FormEncode', |
66 | 127 | 'oauth', | 127 | 'oauth', |
67 | 128 | 'oops', | ||
68 | 129 | 'oops-datedir-repo', | ||
69 | 130 | 'oops-twisted', | ||
70 | 131 | 'PyYAML', | 128 | 'PyYAML', |
71 | 132 | 'South', | 129 | 'South', |
72 | 133 | 'Twisted', | 130 | 'Twisted', |
73 | 134 | 131 | ||
74 | === modified file 'src/maas/settings.py' | |||
75 | --- src/maas/settings.py 2014-12-05 12:48:49 +0000 | |||
76 | +++ src/maas/settings.py 2015-01-14 16:31:22 +0000 | |||
77 | @@ -47,9 +47,6 @@ | |||
78 | 47 | 47 | ||
79 | 48 | MANAGERS = ADMINS | 48 | MANAGERS = ADMINS |
80 | 49 | 49 | ||
81 | 50 | # Location where python-oops should store errors. | ||
82 | 51 | OOPS_REPOSITORY = 'logs/oops' | ||
83 | 52 | |||
84 | 53 | LOGOUT_URL = '/' | 50 | LOGOUT_URL = '/' |
85 | 54 | LOGIN_REDIRECT_URL = '/' | 51 | LOGIN_REDIRECT_URL = '/' |
86 | 55 | LOGIN_URL = '/accounts/login/' | 52 | LOGIN_URL = '/accounts/login/' |
87 | 56 | 53 | ||
88 | === modified file 'src/maasserver/management/commands/runserver.py' | |||
89 | --- src/maasserver/management/commands/runserver.py 2013-10-18 16:57:37 +0000 | |||
90 | +++ src/maasserver/management/commands/runserver.py 2015-01-14 16:31:22 +0000 | |||
91 | @@ -17,39 +17,10 @@ | |||
92 | 17 | from optparse import make_option | 17 | from optparse import make_option |
93 | 18 | from SocketServer import ThreadingMixIn | 18 | from SocketServer import ThreadingMixIn |
94 | 19 | 19 | ||
95 | 20 | from django.conf import settings | ||
96 | 21 | from django.core.management.commands.runserver import BaseRunserverCommand | 20 | from django.core.management.commands.runserver import BaseRunserverCommand |
97 | 22 | from django.core.servers import basehttp | 21 | from django.core.servers import basehttp |
98 | 23 | from django.core.servers.basehttp import WSGIServer | 22 | from django.core.servers.basehttp import WSGIServer |
99 | 24 | from maasserver.start_up import start_up | 23 | from maasserver.start_up import start_up |
100 | 25 | import oops | ||
101 | 26 | from oops_datedir_repo import DateDirRepo | ||
102 | 27 | from oops_wsgi import ( | ||
103 | 28 | install_hooks, | ||
104 | 29 | make_app, | ||
105 | 30 | ) | ||
106 | 31 | |||
107 | 32 | |||
108 | 33 | error_template = """ | ||
109 | 34 | <html> | ||
110 | 35 | <head><title>Oops! - %(id)s</title></head> | ||
111 | 36 | <body> | ||
112 | 37 | <h1>Oops!</h1> | ||
113 | 38 | <p> | ||
114 | 39 | Something broke while generating this page. | ||
115 | 40 | </p> | ||
116 | 41 | <p> | ||
117 | 42 | If the problem persists, please | ||
118 | 43 | <a href="https://bugs.launchpad.net/maas/">file a bug</a>. Make a note of | ||
119 | 44 | the "oops id": <strong>%(id)s</strong> | ||
120 | 45 | </p> | ||
121 | 46 | </html> | ||
122 | 47 | """.lstrip() | ||
123 | 48 | |||
124 | 49 | |||
125 | 50 | def render_error(report): | ||
126 | 51 | """Produce an HTML error report, in raw bytes (not unicode).""" | ||
127 | 52 | return (error_template % report).encode('ascii') | ||
128 | 53 | 24 | ||
129 | 54 | 25 | ||
130 | 55 | class Command(BaseRunserverCommand): | 26 | class Command(BaseRunserverCommand): |
131 | @@ -73,19 +44,3 @@ | |||
132 | 73 | 44 | ||
133 | 74 | start_up() | 45 | start_up() |
134 | 75 | return super(Command, self).run(*args, **options) | 46 | return super(Command, self).run(*args, **options) |
135 | 76 | |||
136 | 77 | def get_handler(self, *args, **kwargs): | ||
137 | 78 | """Overridable from `BaseRunserverCommand`: Obtain a WSGI handler.""" | ||
138 | 79 | wsgi_handler = super(Command, self).get_handler(self, *args, **kwargs) | ||
139 | 80 | |||
140 | 81 | # Wrap the WSGI handler in an oops handler. This catches (most) | ||
141 | 82 | # exceptions bubbling up out of the app, and stores them as | ||
142 | 83 | # oopses in the directory specified by the OOPS_REPOSITORY | ||
143 | 84 | # configuration setting. | ||
144 | 85 | # Django's debug mode causes it to handle exceptions itself, so | ||
145 | 86 | # don't expect oopses when DEBUG is set to True. | ||
146 | 87 | oops_config = oops.Config() | ||
147 | 88 | oops_repository = DateDirRepo(settings.OOPS_REPOSITORY) | ||
148 | 89 | oops_config.publishers.append(oops_repository.publish) | ||
149 | 90 | install_hooks(oops_config) | ||
150 | 91 | return make_app(wsgi_handler, oops_config, error_render=render_error) | ||
151 | 92 | 47 | ||
152 | === removed file 'src/maasserver/tests/test_runserver.py' | |||
153 | --- src/maasserver/tests/test_runserver.py 2013-10-07 09:12:40 +0000 | |||
154 | +++ src/maasserver/tests/test_runserver.py 1970-01-01 00:00:00 +0000 | |||
155 | @@ -1,38 +0,0 @@ | |||
156 | 1 | # Copyright 2012, 2013 Canonical Ltd. This software is licensed under the | ||
157 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | ||
158 | 3 | |||
159 | 4 | """Tests for the "runserver" command module.""" | ||
160 | 5 | |||
161 | 6 | from __future__ import ( | ||
162 | 7 | absolute_import, | ||
163 | 8 | print_function, | ||
164 | 9 | unicode_literals, | ||
165 | 10 | ) | ||
166 | 11 | |||
167 | 12 | str = None | ||
168 | 13 | |||
169 | 14 | __metaclass__ = type | ||
170 | 15 | __all__ = [] | ||
171 | 16 | |||
172 | 17 | from maasserver.management.commands.runserver import render_error | ||
173 | 18 | from maasserver.testing.testcase import MAASServerTestCase | ||
174 | 19 | |||
175 | 20 | |||
176 | 21 | class TestRunServer(MAASServerTestCase): | ||
177 | 22 | |||
178 | 23 | def test_render_error_mentions_oops_id(self): | ||
179 | 24 | fake_oops = {'id': 'EHOVERCRAFTFULL999'} | ||
180 | 25 | self.assertIn(fake_oops['id'], render_error(fake_oops)) | ||
181 | 26 | |||
182 | 27 | def test_render_error_returns_bytes(self): | ||
183 | 28 | # wsgi_oops produces oops pages as unicode strings, but django | ||
184 | 29 | # expects raw bytes. Our own error renderer returns bytes. | ||
185 | 30 | fake_oops = {'id': 'abc123'} | ||
186 | 31 | self.assertIsInstance(render_error(fake_oops), bytes) | ||
187 | 32 | |||
188 | 33 | def test_render_error_blows_up_if_oops_id_is_not_ascii(self): | ||
189 | 34 | # Oopses mean that things aren't working as they should. We | ||
190 | 35 | # won't make things worse by including non-ASCII characters in | ||
191 | 36 | # the oops page. | ||
192 | 37 | fake_oops = {'id': '\u2322'} | ||
193 | 38 | self.assertRaises(Exception, render_error, fake_oops) | ||
194 | 39 | 0 | ||
195 | === modified file 'src/provisioningserver/config.py' | |||
196 | --- src/provisioningserver/config.py 2014-09-23 20:20:16 +0000 | |||
197 | +++ src/provisioningserver/config.py 2015-01-14 16:31:22 +0000 | |||
198 | @@ -87,7 +87,12 @@ | |||
199 | 87 | 87 | ||
200 | 88 | 88 | ||
201 | 89 | class ConfigOops(Schema): | 89 | class ConfigOops(Schema): |
203 | 90 | """Configuration validator for OOPS options.""" | 90 | """Configuration validator for OOPS options. |
204 | 91 | |||
205 | 92 | Deprecated: MAAS no longer records OOPS reports. This remains here to | ||
206 | 93 | avoid validation failures when using old versions of the cluster's | ||
207 | 94 | configuration file. | ||
208 | 95 | """ | ||
209 | 91 | 96 | ||
210 | 92 | if_key_missing = None | 97 | if_key_missing = None |
211 | 93 | 98 | ||
212 | 94 | 99 | ||
213 | === modified file 'src/provisioningserver/plugin.py' | |||
214 | --- src/provisioningserver/plugin.py 2014-10-03 22:46:34 +0000 | |||
215 | +++ src/provisioningserver/plugin.py 2015-01-14 16:31:22 +0000 | |||
216 | @@ -14,20 +14,12 @@ | |||
217 | 14 | __metaclass__ = type | 14 | __metaclass__ = type |
218 | 15 | __all__ = [ | 15 | __all__ = [ |
219 | 16 | "LogService", | 16 | "LogService", |
220 | 17 | "OOPSService", | ||
221 | 18 | "ProvisioningServiceMaker", | 17 | "ProvisioningServiceMaker", |
222 | 19 | ] | 18 | ] |
223 | 20 | 19 | ||
224 | 21 | import signal | 20 | import signal |
225 | 22 | import sys | 21 | import sys |
226 | 23 | 22 | ||
227 | 24 | import oops | ||
228 | 25 | from oops_datedir_repo import DateDirRepo | ||
229 | 26 | from oops_twisted import ( | ||
230 | 27 | Config as oops_config, | ||
231 | 28 | defer_publisher, | ||
232 | 29 | OOPSObserver, | ||
233 | 30 | ) | ||
234 | 31 | import provisioningserver | 23 | import provisioningserver |
235 | 32 | from provisioningserver.cluster_config import get_cluster_uuid | 24 | from provisioningserver.cluster_config import get_cluster_uuid |
236 | 33 | from provisioningserver.config import Config | 25 | from provisioningserver.config import Config |
237 | @@ -61,11 +53,7 @@ | |||
238 | 61 | ) | 53 | ) |
239 | 62 | from twisted.plugin import IPlugin | 54 | from twisted.plugin import IPlugin |
240 | 63 | from twisted.python import usage | 55 | from twisted.python import usage |
246 | 64 | from twisted.python.log import ( | 56 | from twisted.python.log import FileLogObserver |
242 | 65 | addObserver, | ||
243 | 66 | FileLogObserver, | ||
244 | 67 | removeObserver, | ||
245 | 68 | ) | ||
247 | 69 | from twisted.python.logfile import LogFile | 57 | from twisted.python.logfile import LogFile |
248 | 70 | from twisted.web.resource import ( | 58 | from twisted.web.resource import ( |
249 | 71 | IResource, | 59 | IResource, |
250 | @@ -153,38 +141,6 @@ | |||
251 | 153 | self.logfile = None | 141 | self.logfile = None |
252 | 154 | 142 | ||
253 | 155 | 143 | ||
254 | 156 | class OOPSService(Service): | ||
255 | 157 | |||
256 | 158 | name = "oops" | ||
257 | 159 | |||
258 | 160 | def __init__(self, log_service, oops_dir, oops_reporter): | ||
259 | 161 | self.config = None | ||
260 | 162 | self.log_service = log_service | ||
261 | 163 | self.oops_dir = oops_dir | ||
262 | 164 | self.oops_reporter = oops_reporter | ||
263 | 165 | |||
264 | 166 | def startService(self): | ||
265 | 167 | Service.startService(self) | ||
266 | 168 | self.config = oops_config() | ||
267 | 169 | # Add the oops publisher that writes files in the configured place if | ||
268 | 170 | # the command line option was set. | ||
269 | 171 | if self.oops_dir: | ||
270 | 172 | repo = DateDirRepo(self.oops_dir) | ||
271 | 173 | self.config.publishers.append( | ||
272 | 174 | defer_publisher(oops.publish_new_only(repo.publish))) | ||
273 | 175 | if self.oops_reporter: | ||
274 | 176 | self.config.template['reporter'] = self.oops_reporter | ||
275 | 177 | self.observer = OOPSObserver( | ||
276 | 178 | self.config, self.log_service.observer.emit) | ||
277 | 179 | addObserver(self.observer.emit) | ||
278 | 180 | |||
279 | 181 | def stopService(self): | ||
280 | 182 | Service.stopService(self) | ||
281 | 183 | removeObserver(self.observer.emit) | ||
282 | 184 | self.observer = None | ||
283 | 185 | self.config = None | ||
284 | 186 | |||
285 | 187 | |||
286 | 188 | class Options(usage.Options): | 144 | class Options(usage.Options): |
287 | 189 | """Command line options for the provisioning server.""" | 145 | """Command line options for the provisioning server.""" |
288 | 190 | 146 | ||
289 | @@ -207,12 +163,6 @@ | |||
290 | 207 | """Create the log service.""" | 163 | """Create the log service.""" |
291 | 208 | return LogService(config["logfile"]) | 164 | return LogService(config["logfile"]) |
292 | 209 | 165 | ||
293 | 210 | def _makeOopsService(self, log_service, oops_config): | ||
294 | 211 | """Create the oops service.""" | ||
295 | 212 | oops_dir = oops_config["directory"] | ||
296 | 213 | oops_reporter = oops_config["reporter"] | ||
297 | 214 | return OOPSService(log_service, oops_dir, oops_reporter) | ||
298 | 215 | |||
299 | 216 | def _makeSiteService(self, papi_xmlrpc, config): | 166 | def _makeSiteService(self, papi_xmlrpc, config): |
300 | 217 | """Create the site service.""" | 167 | """Create the site service.""" |
301 | 218 | site_root = Resource() | 168 | site_root = Resource() |
302 | @@ -268,9 +218,6 @@ | |||
303 | 268 | log_service = self._makeLogService(config) | 218 | log_service = self._makeLogService(config) |
304 | 269 | log_service.setServiceParent(services) | 219 | log_service.setServiceParent(services) |
305 | 270 | 220 | ||
306 | 271 | oops_service = self._makeOopsService(log_service, config["oops"]) | ||
307 | 272 | oops_service.setServiceParent(services) | ||
308 | 273 | |||
309 | 274 | tftp_service = self._makeTFTPService(config["tftp"]) | 221 | tftp_service = self._makeTFTPService(config["tftp"]) |
310 | 275 | tftp_service.setServiceParent(services) | 222 | tftp_service.setServiceParent(services) |
311 | 276 | 223 | ||
312 | 277 | 224 | ||
313 | === modified file 'src/provisioningserver/tests/test_config.py' | |||
314 | --- src/provisioningserver/tests/test_config.py 2014-08-20 19:04:17 +0000 | |||
315 | +++ src/provisioningserver/tests/test_config.py 2015-01-14 16:31:22 +0000 | |||
316 | @@ -367,8 +367,6 @@ | |||
317 | 367 | 367 | ||
318 | 368 | default_development_config = deepcopy(default_production_config) | 368 | default_development_config = deepcopy(default_production_config) |
319 | 369 | default_development_config.update(logfile="/dev/null") | 369 | default_development_config.update(logfile="/dev/null") |
320 | 370 | default_development_config["oops"].update( | ||
321 | 371 | directory="logs/oops", reporter="maas-pserv") | ||
322 | 372 | default_development_config["tftp"].update( | 370 | default_development_config["tftp"].update( |
323 | 373 | port=5244, generator="http://localhost:5243/api/1.0/pxeconfig/") | 371 | port=5244, generator="http://localhost:5243/api/1.0/pxeconfig/") |
324 | 374 | 372 | ||
325 | 375 | 373 | ||
326 | === modified file 'src/provisioningserver/tests/test_plugin.py' | |||
327 | --- src/provisioningserver/tests/test_plugin.py 2014-10-02 11:53:59 +0000 | |||
328 | +++ src/provisioningserver/tests/test_plugin.py 2015-01-14 16:31:22 +0000 | |||
329 | @@ -118,7 +118,7 @@ | |||
330 | 118 | self.assertIsInstance(service, MultiService) | 118 | self.assertIsInstance(service, MultiService) |
331 | 119 | expected_services = [ | 119 | expected_services = [ |
332 | 120 | "dhcp_probe", "image_download", "lease_upload", "log", | 120 | "dhcp_probe", "image_download", "lease_upload", "log", |
334 | 121 | "node_monitor", "oops", "rpc", "tftp", | 121 | "node_monitor", "rpc", "tftp", |
335 | 122 | ] | 122 | ] |
336 | 123 | self.assertItemsEqual(expected_services, service.namedServices) | 123 | self.assertItemsEqual(expected_services, service.namedServices) |
337 | 124 | self.assertEqual( | 124 | self.assertEqual( |
338 | 125 | 125 | ||
339 | === modified file 'src/provisioningserver/tests/test_plugin_services.py' | |||
340 | --- src/provisioningserver/tests/test_plugin_services.py 2014-09-01 08:40:13 +0000 | |||
341 | +++ src/provisioningserver/tests/test_plugin_services.py 2015-01-14 16:31:22 +0000 | |||
342 | @@ -14,20 +14,14 @@ | |||
343 | 14 | __metaclass__ = type | 14 | __metaclass__ = type |
344 | 15 | __all__ = [] | 15 | __all__ = [] |
345 | 16 | 16 | ||
346 | 17 | import os | ||
347 | 18 | import signal | 17 | import signal |
348 | 19 | import sys | 18 | import sys |
349 | 20 | 19 | ||
350 | 21 | from maastesting.factory import factory | ||
351 | 22 | from maastesting.testcase import ( | 20 | from maastesting.testcase import ( |
352 | 23 | MAASTestCase, | 21 | MAASTestCase, |
353 | 24 | MAASTwistedRunTest, | 22 | MAASTwistedRunTest, |
354 | 25 | ) | 23 | ) |
360 | 26 | from oops_twisted import OOPSObserver | 24 | from provisioningserver.plugin import LogService |
356 | 27 | from provisioningserver.plugin import ( | ||
357 | 28 | LogService, | ||
358 | 29 | OOPSService, | ||
359 | 30 | ) | ||
361 | 31 | from testtools.content import content_from_file | 25 | from testtools.content import content_from_file |
362 | 32 | from twisted.application.service import MultiService | 26 | from twisted.application.service import MultiService |
363 | 33 | from twisted.python.log import ( | 27 | from twisted.python.log import ( |
364 | @@ -91,33 +85,3 @@ | |||
365 | 91 | self.assertEqual( | 85 | self.assertEqual( |
366 | 92 | signal.getsignal(signal.SIGUSR1), | 86 | signal.getsignal(signal.SIGUSR1), |
367 | 93 | log_service._signal_handler) | 87 | log_service._signal_handler) |
368 | 94 | |||
369 | 95 | |||
370 | 96 | class TestOOPSService(TestServicesBase, MAASTestCase): | ||
371 | 97 | """Tests for `provisioningserver.services.OOPSService`.""" | ||
372 | 98 | |||
373 | 99 | def setUp(self): | ||
374 | 100 | super(TestOOPSService, self).setUp() | ||
375 | 101 | # OOPSService relies upon LogService. | ||
376 | 102 | self.tempdir = self.make_dir() | ||
377 | 103 | self.log_filename = factory.make_file( | ||
378 | 104 | location=self.tempdir, name="test.log") | ||
379 | 105 | self.log_service = LogService(self.log_filename) | ||
380 | 106 | self.log_service.setServiceParent(self.services) | ||
381 | 107 | |||
382 | 108 | def test_minimal(self): | ||
383 | 109 | oops_service = OOPSService(self.log_service, None, None) | ||
384 | 110 | oops_service.setServiceParent(self.services) | ||
385 | 111 | observer = oops_service.observer | ||
386 | 112 | self.assertIsInstance(observer, OOPSObserver) | ||
387 | 113 | self.assertEqual([], observer.config.publishers) | ||
388 | 114 | self.assertEqual({}, observer.config.template) | ||
389 | 115 | |||
390 | 116 | def test_with_all_params(self): | ||
391 | 117 | oops_dir = os.path.join(self.tempdir, "oops") | ||
392 | 118 | oops_service = OOPSService(self.log_service, oops_dir, "Sidebottom") | ||
393 | 119 | oops_service.setServiceParent(self.services) | ||
394 | 120 | observer = oops_service.observer | ||
395 | 121 | self.assertIsInstance(observer, OOPSObserver) | ||
396 | 122 | self.assertEqual(1, len(observer.config.publishers)) | ||
397 | 123 | self.assertEqual({"reporter": "Sidebottom"}, observer.config.template) |
I am very happy to review this!
Glad its gone!