Merge lp:~rcj/charms/precise/nrpe/trunk into lp:charms/nrpe
- Precise Pangolin (12.04)
- trunk
- Merge into trunk
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 35 | ||||
Proposed branch: | lp:~rcj/charms/precise/nrpe/trunk | ||||
Merge into: | lp:charms/nrpe | ||||
Diff against target: |
427 lines (+203/-80) 8 files modified
README.md (+30/-1) hooks/config-changed (+19/-14) hooks/local-monitors-relation-changed (+7/-3) hooks/recursive_dictionary.py (+7/-6) tests/00-setup (+1/-1) tests/10-monitors (+64/-0) tests/20-local_monitors (+75/-0) tests/99-autogen (+0/-55) |
||||
To merge this branch: | bzr merge lp:~rcj/charms/precise/nrpe/trunk | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Marco Ceppi (community) | Approve | ||
Adam Israel (community) | Approve | ||
Robert C Jennings (community) | Needs Resubmitting | ||
Review Queue (community) | automated testing | Needs Fixing | |
Review via email:
|
Commit message
Description of the change
nrpe charm pep8/pylint cleanup and additional testing

Review Queue (review-queue) wrote : | # |

Review Queue (review-queue) wrote : | # |
This items has failed automated testing! Results available here http://

Adam Israel (aisrael) wrote : | # |
Hi Robert,
Thanks for all of your efforts getting this charm cleaned up. I had the opportunity to review the charm today, and wanted to provide some feedback.
I attempted to run the tests both manually, and how the automated testing runs (using bundletester).
Bundletester, run from the charm directory, failed:
$ bundletester -l DEBUG
...
DEBUG:runner:call ['/vagrant/
DEBUG:runner:
Traceback (most recent call last):
File "/vagrant/
with open('.
FileNotFoundError: [Errno 2] No such file or directory: '../test-
DEBUG:runner:Exit Code: 1
20-
The 'test-monitors.
Next, I reset my environment and ran the tests by hand. I still encountered an error running 20-local_monitors, however.
$ ./20-local_monitors
2014-10-29 16:02:31 Starting deployment of local
2014-10-29 16:02:31 Deploying services...
2014-10-29 16:02:38 Adding relations...
2014-10-29 16:02:39 Adding relation nrpe:local-monitors <-> apache2:
2014-10-29 16:03:39 Deployment complete in 69.14 seconds
Expected file on nrpe not found: /etc/nagios/

Adam Israel (aisrael) wrote : | # |
Here are some additional details that might help:
$ juju status
environment: local
machines:
"0":
agent-state: started
agent-version: 1.20.10.1
dns-name: localhost
instance-id: localhost
series: trusty
state-
"1":
agent-state: started
agent-version: 1.20.10.1
dns-name: 10.0.3.171
instance-id: vagrant-
series: precise
hardware: arch=amd64
"2":
agent-state: started
agent-version: 1.20.10.1
dns-name: 10.0.3.222
instance-id: vagrant-
series: precise
hardware: arch=amd64
services:
apache2:
charm: cs:precise/
exposed: false
relations:
juju-info:
- nrpe
local-
- nrpe
units:
apache2/0:
machine: "1"
nrpe/0:
nagios:
charm: cs:precise/
exposed: false
relations:
monitors:
- nrpe
units:
nagios/0:
machine: "2"
open-ports:
- 80/tcp
nrpe:
charm: cs:precise/nrpe-7
exposed: false
relations:
general-info:
- apache2
local-
- apache2
monitors:
- nagios
subordinate-to:
- apache2
ubuntu@
total 16
drwxr-xr-x 1 root root 114 Oct 29 16:00 .
drwxr-xr-x 1 root root 56 Oct 29 16:00 ..
-rwxr----- 1 root root 25 Oct 29 16:00 allowed.hosts.cfg
-rw-r--r-- 1 root root 144 Oct 29 16:00 base-monitors.cfg
-rw-r--r-- 1 root root 96 Oct 29 16:02 check_mem.cfg
-rw-r--r-- 1 root root 67 Oct 29 16:02 disk__.cfg

Review Queue (review-queue) wrote : | # |
This items has failed automated testing! Results available here http://

Marco Ceppi (marcoceppi) wrote : | # |
I'm moving this back in to "work in progress" When you're ready for another review please move this merge to "needs review"

Robert C Jennings (rcj) wrote : | # |
I have corrected the file path issue and rebased against the current tree.

Robert C Jennings (rcj) wrote : | # |
Please review with latest changes and retest. Thank you.

Adam Israel (aisrael) wrote : | # |
Hi Robert,
I took a look at this late last week. I'm happy to report that it merges cleanly and all tests are passing, against local and amazon providers. Thanks again for all of your efforts on this!
+1
Preview Diff
1 | === renamed file 'README' => 'README.md' |
2 | --- README 2012-07-26 23:39:54 +0000 |
3 | +++ README.md 2015-04-02 19:42:00 +0000 |
4 | @@ -1,10 +1,39 @@ |
5 | +# Overview |
6 | + |
7 | This charm provides an nrpe subordinate to integrate with nagios logging. |
8 | |
9 | Adding the charm as a subordinate to a service will run an nrpe server |
10 | on the unit and allow for nagios to query the service using that server. |
11 | |
12 | +# Usage |
13 | + |
14 | +Deploy the charm as a subordinate of an existing service. In this example |
15 | +we will deploy a Trusty version of the Apache2 charm and add nrpe to it. |
16 | +The relationship, `general-monitors`, provides basic monitoring data. |
17 | + |
18 | + juju deploy nagios |
19 | + juju deploy cs:precise/apache2 |
20 | + juju deploy cs:precise/nrpe |
21 | + juju add-relation nrpe:general-monitors apache2:juju-info |
22 | + juju add-relation nrpe:monitors nagios:monitors |
23 | + |
24 | +In this second example we will use the `local-monitors` relationship with |
25 | +Apache2. The Apache2 charm provides a `local-monitors` relationship that |
26 | +will add additional monitoring checks. |
27 | + |
28 | + juju deploy nagios |
29 | + juju deploy cs:precise/apache2 |
30 | + juju deploy cs:precise/nrpe |
31 | + juju add-relation nrpe:local-monitors apache2: local-monitors |
32 | + juju add-relation nrpe:monitors nagios:monitors |
33 | + |
34 | +Note that a series for nagios is not specified as nrpe can communicate |
35 | +with nagios charms of different series. |
36 | + |
37 | +# Charm relationship data |
38 | + |
39 | The service provides a 'local-monitors' container scoped interface |
40 | -to define the plugins that the nrpe server can use. The charm should |
41 | +to define the plug-ins that the nrpe server can use. The charm should |
42 | 'relation-set monitors=monitors' with a monitors.yaml in the same |
43 | format as the 'monitors' relation seen in the nagios charm. This will |
44 | be merged with the base monitors and any monitors configured via the |
45 | |
46 | === modified file 'hooks/config-changed' |
47 | --- hooks/config-changed 2012-07-26 23:37:43 +0000 |
48 | +++ hooks/config-changed 2015-04-02 19:42:00 +0000 |
49 | @@ -11,13 +11,16 @@ |
50 | |
51 | PLUGIN_PATH = '/usr/lib/nagios/plugins' |
52 | |
53 | -base_yaml = RecursiveDictionary(yaml.safe_load(open('base-monitors.yaml','r'))) |
54 | +with open('base-monitors.yaml', 'r') as base_monitors: |
55 | + base_yaml = RecursiveDictionary(yaml.safe_load(base_monitors)) |
56 | yamls = [] |
57 | if len(sys.argv) > 1: |
58 | for f in sys.argv[1:]: |
59 | yamls.append(yaml.safe_load(open(f))) |
60 | else: |
61 | - cmon = json.loads(subprocess.check_output(['config-get','monitors','--format=json'])) |
62 | + cmon = json.loads(subprocess.check_output(['config-get', |
63 | + 'monitors', |
64 | + '--format=json'])) |
65 | if cmon is not None and type(cmon) != dict: |
66 | cmon = yaml.safe_load(cmon) |
67 | if cmon is not None: |
68 | @@ -32,25 +35,27 @@ |
69 | |
70 | base_yaml = dict(base_yaml) |
71 | |
72 | + |
73 | def make_command(mclass, mon): |
74 | cmd_name = 'check_true' |
75 | cmd_line = ['/usr/bin/true'] |
76 | |
77 | if mclass == 'procrunning' or mclass == 'processcount': |
78 | - executable = mon.get('executable','') |
79 | - cmd_name = '%s_%s' % (mclass, executable.replace('/','_')) |
80 | - range_arg = '%s:%s' % (mon.get('min',''), mon.get('max','')) |
81 | + executable = mon.get('executable', '') |
82 | + cmd_name = '%s_%s' % (mclass, executable.replace('/', '_')) |
83 | + range_arg = '%s:%s' % (mon.get('min', ''), mon.get('max', '')) |
84 | cmd = os.path.join(PLUGIN_PATH, 'check_procs') |
85 | - cmd_line = [cmd,'-w',range_arg,'-c',range_arg] |
86 | + cmd_line = [cmd, '-w', range_arg, '-c', range_arg] |
87 | if executable: |
88 | - cmd_line.extend(('-C',executable)) |
89 | + cmd_line.extend(('-C', executable)) |
90 | elif mclass == 'mem': |
91 | cmd_name = 'check_mem' |
92 | - cmd = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), |
93 | - '..', 'plugins', 'check_mem.pl')) |
94 | + cmd = os.path.abspath(os.path.join( |
95 | + os.path.dirname(os.path.abspath(__file__)), |
96 | + '..', 'plugins', 'check_mem.pl')) |
97 | cmd_line = [cmd, '-C', '-u', '-w', '85', '-c', '90'] |
98 | elif mclass == 'disk': |
99 | - path = mon.get('path','/') |
100 | + path = mon.get('path', '/') |
101 | cmd_name = 'disk_%s' % (path.replace('/', '_')) |
102 | cmd = os.path.join(PLUGIN_PATH, 'check_disk') |
103 | cmd_line = [cmd, '-w', '20', '-c', '10', '-p', path] |
104 | @@ -65,8 +70,8 @@ |
105 | return cmd_name |
106 | |
107 | # Now transform local's into remote nrpe's |
108 | -local = base_yaml['monitors'].get('local',{}) |
109 | -out_remotes = base_yaml['monitors'].get('remote',{}) |
110 | +local = base_yaml['monitors'].get('local', {}) |
111 | +out_remotes = base_yaml['monitors'].get('remote', {}) |
112 | for mclass, mons in local.iteritems(): |
113 | if 'nrpe' not in out_remotes: |
114 | out_remotes['nrpe'] = {} |
115 | @@ -93,7 +98,7 @@ |
116 | print yaml.safe_dump(base_yaml) |
117 | sys.exit(0) |
118 | |
119 | -with open('monitors.yaml','w') as end_yaml: |
120 | +with open('monitors.yaml', 'w') as end_yaml: |
121 | yaml.safe_dump(base_yaml, end_yaml) |
122 | |
123 | -subprocess.call(['service','nagios-nrpe-server','restart']) |
124 | +subprocess.call(['service', 'nagios-nrpe-server', 'restart']) |
125 | |
126 | === modified file 'hooks/local-monitors-relation-changed' |
127 | --- hooks/local-monitors-relation-changed 2012-07-27 00:18:58 +0000 |
128 | +++ hooks/local-monitors-relation-changed 2015-04-02 19:42:00 +0000 |
129 | @@ -9,13 +9,17 @@ |
130 | print 'Need JUJU_REMOTE_UNIT to run' |
131 | sys.exit(0) |
132 | |
133 | -primary_id=os.environ['JUJU_REMOTE_UNIT'].replace('/','-') |
134 | +primary_id = os.environ['JUJU_REMOTE_UNIT'].replace('/', '-') |
135 | + |
136 | if not os.path.exists('data'): |
137 | os.mkdir('data') |
138 | -with open('data/primary_id','w') as primid: |
139 | +with open('data/primary_id', 'w') as primid: |
140 | primid.write(primary_id) |
141 | |
142 | -monitors = json.loads(subprocess.check_output(['relation-get','--format=json','monitors'])) |
143 | +monitors = json.loads(subprocess.check_output(['relation-get', |
144 | + '--format=json', |
145 | + 'monitors'])) |
146 | + |
147 | if monitors is None or len(monitors) == 0: |
148 | sys.exit(0) |
149 | |
150 | |
151 | === modified file 'hooks/recursive_dictionary.py' |
152 | --- hooks/recursive_dictionary.py 2012-07-04 19:04:20 +0000 |
153 | +++ hooks/recursive_dictionary.py 2015-04-02 19:42:00 +0000 |
154 | @@ -6,17 +6,17 @@ |
155 | # which makes it easier to deal with yaml dump/load |
156 | # |
157 | # Copyright (c) 2009 Jannis Andrija Schnitzer |
158 | -# |
159 | +# |
160 | # Permission is hereby granted, free of charge, to any person obtaining a copy |
161 | # of this software and associated documentation files (the "Software"), to deal |
162 | # in the Software without restriction, including without limitation the rights |
163 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
164 | # copies of the Software, and to permit persons to whom the Software is |
165 | # furnished to do so, subject to the following conditions: |
166 | -# |
167 | +# |
168 | # The above copyright notice and this permission notice shall be included in |
169 | # all copies or substantial portions of the Software. |
170 | -# |
171 | +# |
172 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
173 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
174 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
175 | @@ -27,6 +27,7 @@ |
176 | |
177 | __author__ = 'jannis@itisme.org (Jannis Andrija Schnitzer)' |
178 | |
179 | + |
180 | class RecursiveDictionary(dict): |
181 | """RecursiveDictionary provides the methods rec_update and iter_rec_update |
182 | that can be used to update member dictionaries rather than overwriting |
183 | @@ -34,7 +35,7 @@ |
184 | def rec_update(self, other, **third): |
185 | """Recursively update the dictionary with the contents of other and |
186 | third like dict.update() does - but don't overwrite sub-dictionaries. |
187 | - |
188 | + |
189 | Example: |
190 | >>> d = RecursiveDictionary({'foo': {'bar': 42}}) |
191 | >>> d.rec_update({'foo': {'baz': 36}}) |
192 | @@ -47,7 +48,7 @@ |
193 | iterator = other |
194 | self.iter_rec_update(iterator) |
195 | self.iter_rec_update(third.iteritems()) |
196 | - |
197 | + |
198 | def iter_rec_update(self, iterator): |
199 | for (key, value) in iterator: |
200 | if key in self and \ |
201 | @@ -58,6 +59,6 @@ |
202 | self[key] = dict(self[key]) |
203 | else: |
204 | self[key] = value |
205 | - |
206 | + |
207 | def __repr__(self): |
208 | return super(self.__class__, self).__repr__() |
209 | |
210 | === modified file 'tests/00-setup' |
211 | --- tests/00-setup 2014-11-06 21:21:58 +0000 |
212 | +++ tests/00-setup 2015-04-02 19:42:00 +0000 |
213 | @@ -2,4 +2,4 @@ |
214 | |
215 | sudo add-apt-repository ppa:juju/stable -y |
216 | sudo apt-get update |
217 | -sudo apt-get install amulet python3-requests -y |
218 | +sudo apt-get install amulet -y |
219 | |
220 | === added file 'tests/10-monitors' |
221 | --- tests/10-monitors 1970-01-01 00:00:00 +0000 |
222 | +++ tests/10-monitors 2015-04-02 19:42:00 +0000 |
223 | @@ -0,0 +1,64 @@ |
224 | +#!/usr/bin/python3 |
225 | + |
226 | +import amulet |
227 | +import subprocess |
228 | + |
229 | + |
230 | +def file_exists(unit, unit_name, filename): |
231 | + try: |
232 | + unit.file(filename) |
233 | + except: |
234 | + amulet.raise_status(amulet.FAIL, |
235 | + 'Expected file on {} not found: {}'.format(unit_name, |
236 | + filename)) |
237 | + |
238 | + |
239 | +d = amulet.Deployment(series='precise') |
240 | + |
241 | +# Use known charms for the deploy. |
242 | +d.add('nagios', charm='cs:precise/nagios-10') |
243 | +d.add('apache2', charm='cs:precise/apache2-25') |
244 | + |
245 | +# The nrpe charm will be subordinate to apache2. |
246 | +d.add('nrpe') |
247 | + |
248 | +# NRPE monitors apache2 and answers to Nagios |
249 | +d.relate('nrpe:monitors', 'nagios:monitors') |
250 | +d.relate('nrpe:general-info', 'apache2:juju-info') |
251 | + |
252 | +try: |
253 | + d.setup(timeout=1200) |
254 | + d.sentry.wait(timeout=1200) |
255 | +except amulet.helpers.TimeoutError: |
256 | + amulet.raise_status(amulet.SKIP, msg="Environment wasn't stood up in time") |
257 | +except: |
258 | + raise |
259 | + |
260 | +nrpe = d.sentry.unit['apache2/0'] |
261 | +nagios = d.sentry.unit['nagios/0'] |
262 | + |
263 | +# Check for nrpe configration files |
264 | +file_exists(nrpe, 'nrpe', '/etc/nagios/nrpe.d/base-monitors.cfg') |
265 | +file_exists(nrpe, 'nrpe', '/etc/nagios/nrpe.d/check_mem.cfg') |
266 | +file_exists(nrpe, 'nrpe', '/etc/nagios/nrpe.d/disk__.cfg') |
267 | +file_exists(nrpe, 'nrpe', '/etc/nagios/nrpe.d/allowed.hosts.cfg') |
268 | + |
269 | +# Check for nagios configration files from nrpe |
270 | +base_nagios = '/etc/nagios3/conf.d/commands' |
271 | +file_exists(nagios, 'nagios', |
272 | + '/'.join((base_nagios, 'check_nrpe_H_HOSTADDRESS__ccheck_mem.cfg'))) |
273 | +file_exists(nagios, 'nagios', |
274 | + '/'.join((base_nagios, 'check_nrpe_H_HOSTADDRESS__cdisk__.cfg'))) |
275 | + |
276 | +# Check that nagios knows the IP of of the unit with nrpe |
277 | +apache_private_address = subprocess.check_output(['juju', 'run', |
278 | + '-e', d.juju_env, |
279 | + '--unit', 'apache2/0', |
280 | + 'unit-get private-address']) |
281 | +nagios_charm_cfg = nagios.file_contents('/etc/nagios3/conf.d/charm.cfg') |
282 | +apache_private_address = apache_private_address.decode('utf-8') |
283 | +if nagios_charm_cfg.find(apache_private_address) == -1: |
284 | + amulet.raise_status(amulet.FAIL, |
285 | + msg='IP for nrpe host not in nagios config') |
286 | + |
287 | +amulet.raise_status(amulet.PASS, msg='monitors<->juju-info relationship pass') |
288 | |
289 | === added file 'tests/20-local_monitors' |
290 | --- tests/20-local_monitors 1970-01-01 00:00:00 +0000 |
291 | +++ tests/20-local_monitors 2015-04-02 19:42:00 +0000 |
292 | @@ -0,0 +1,75 @@ |
293 | +#!/usr/bin/python3 |
294 | + |
295 | +import amulet |
296 | +import subprocess |
297 | + |
298 | + |
299 | +def file_exists(unit, unit_name, filename): |
300 | + try: |
301 | + unit.file(filename) |
302 | + except: |
303 | + amulet.raise_status(amulet.FAIL, |
304 | + 'Expected file on {} not found: {}'.format(unit_name, |
305 | + filename)) |
306 | + |
307 | + |
308 | +d = amulet.Deployment(series='precise') |
309 | + |
310 | +# Use known charms for the deploy. |
311 | +d.add('nagios', charm='cs:precise/nagios-10') |
312 | +d.add('apache2', charm='cs:precise/apache2-25') |
313 | + |
314 | +# The nrpe charm will be subordinate to apache2. |
315 | +d.add('nrpe') |
316 | + |
317 | +with open('test-monitors.yaml', 'r') as monitors_file: |
318 | + monitors_cfg = monitors_file.read() |
319 | +# Configure nrpe with some test monitors |
320 | +d.configure('nrpe', options={'monitors': monitors_cfg}) |
321 | + |
322 | +# NRPE monitors apache2 and answers to Nagios |
323 | +d.relate('nrpe:monitors', 'nagios:monitors') |
324 | +d.relate('nrpe:local-monitors', 'apache2:local-monitors') |
325 | + |
326 | +try: |
327 | + d.setup(timeout=1200) |
328 | + d.sentry.wait(timeout=1200) |
329 | +except amulet.helpers.TimeoutError: |
330 | + amulet.raise_status(amulet.SKIP, msg="Environment wasn't stood up in time") |
331 | +except: |
332 | + raise |
333 | + |
334 | +nrpe = d.sentry.unit['apache2/0'] |
335 | +nagios = d.sentry.unit['nagios/0'] |
336 | + |
337 | +# Check for nrpe configration files |
338 | +file_exists(nrpe, 'nrpe', '/etc/nagios/nrpe.d/allowed.hosts.cfg') |
339 | +file_exists(nrpe, 'nrpe', '/etc/nagios/nrpe.d/base-monitors.cfg') |
340 | +file_exists(nrpe, 'nrpe', '/etc/nagios/nrpe.d/check_mem.cfg') |
341 | +file_exists(nrpe, 'nrpe', '/etc/nagios/nrpe.d/check_true.cfg') |
342 | +file_exists(nrpe, 'nrpe', '/etc/nagios/nrpe.d/disk__.cfg') |
343 | +file_exists(nrpe, 'nrpe', '/etc/nagios/nrpe.d/processcount_.cfg') |
344 | + |
345 | +# Check for nagios configration files from nrpe |
346 | +base_nagios = '/etc/nagios3/conf.d/commands' |
347 | +file_exists(nagios, 'nagios', |
348 | + '/'.join((base_nagios, 'check_nrpe_H_HOSTADDRESS__ccheck_mem.cfg'))) |
349 | +file_exists(nagios, 'nagios', |
350 | + '/'.join((base_nagios, 'check_nrpe_H_HOSTADDRESS__ccheck_true.cfg'))) |
351 | +file_exists(nagios, 'nagios', |
352 | + '/'.join((base_nagios, 'check_nrpe_H_HOSTADDRESS__cdisk__.cfg'))) |
353 | +file_exists(nagios, 'nagios', |
354 | + '/'.join((base_nagios, 'check_nrpe_H_HOSTADDRESS__cprocesscount_.cfg'))) |
355 | + |
356 | +# Check that nagios knows the IP of of the unit with nrpe |
357 | +apache_private_address = subprocess.check_output(['juju', 'run', |
358 | + '-e', d.juju_env, |
359 | + '--unit', 'apache2/0', |
360 | + 'unit-get private-address']) |
361 | +apache_private_address = apache_private_address.decode('utf-8') |
362 | +nagios_charm_cfg = nagios.file_contents('/etc/nagios3/conf.d/charm.cfg') |
363 | +if nagios_charm_cfg.find(apache_private_address) == -1: |
364 | + amulet.raise_status(amulet.FAIL, |
365 | + msg='IP for nrpe host not in nagios config') |
366 | + |
367 | +amulet.raise_status(amulet.PASS, msg='local-monitors relationship pass') |
368 | |
369 | === removed file 'tests/99-autogen' |
370 | --- tests/99-autogen 2014-11-20 19:45:39 +0000 |
371 | +++ tests/99-autogen 1970-01-01 00:00:00 +0000 |
372 | @@ -1,55 +0,0 @@ |
373 | -#!/usr/bin/env python3 |
374 | - |
375 | -import amulet |
376 | -import requests |
377 | -import unittest |
378 | - |
379 | - |
380 | -class TestDeployment(unittest.TestCase): |
381 | - @classmethod |
382 | - def setUpClass(cls): |
383 | - cls.deployment = amulet.Deployment(series='precise') |
384 | - |
385 | - cls.deployment.add('nrpe') |
386 | - cls.deployment.add('nagios') |
387 | - cls.deployment.add('mysql') |
388 | - cls.deployment.add('ubuntu') |
389 | - cls.deployment.relate('nrpe:monitors', 'nagios:monitors') |
390 | - cls.deployment.relate('nrpe:local-monitors', 'mysql:local-monitors') |
391 | - cls.deployment.relate('nrpe:general-info', 'ubuntu:juju-info') |
392 | - |
393 | - try: |
394 | - cls.deployment.setup(timeout=900) |
395 | - cls.deployment.sentry.wait() |
396 | - except amulet.helpers.TimeoutError: |
397 | - amulet.raise_status(amulet.SKIP, msg="Environment wasn't stood up in time") |
398 | - except: |
399 | - raise |
400 | - |
401 | - def test_case(self): |
402 | - # Now you can use self.deployment.sentry.unit[UNIT] to address each of |
403 | - # the units and perform more in-depth steps. You can also reference |
404 | - # the first unit as self.unit. |
405 | - # There are three test statuses that can be triggered with |
406 | - # amulet.raise_status(): |
407 | - # - amulet.PASS |
408 | - # - amulet.FAIL |
409 | - # - amulet.SKIP |
410 | - # Each unit has the following methods: |
411 | - # - .info - An array of the information of that unit from Juju |
412 | - # - .file(PATH) - Get the details of a file on that unit |
413 | - # - .file_contents(PATH) - Get plain text output of PATH file from that unit |
414 | - # - .directory(PATH) - Get details of directory |
415 | - # - .directory_contents(PATH) - List files and folders in PATH on that unit |
416 | - # - .relation(relation, service:rel) - Get relation data from return service |
417 | - # add tests here to confirm service is up and working properly |
418 | - # For example, to confirm that it has a functioning HTTP server: |
419 | - # page = requests.get('http://{}'.format(self.unit.info['public-address'])) |
420 | - # page.raise_for_status() |
421 | - # More information on writing Amulet tests can be found at: |
422 | - # https://juju.ubuntu.com/docs/tools-amulet.html |
423 | - pass |
424 | - |
425 | - |
426 | -if __name__ == '__main__': |
427 | - unittest.main() |
This items has failed automated testing! Results available here http:// reports. vapour. ws/charm- tests/charm- bundle- test-1051- results