8 class TestCharm(unittest.TestCase):
10 self.d = amulet.Deployment()
12 self.d.add('layer-netutils')
13 self.d.expose('layer-netutils')
15 self.d.setup(timeout=900)
18 self.unit = self.d.sentry['layer-netutils'][0]
20 def test_service(self):
21 # test we can access over http
22 page = requests.get('http://{}'.format(self.unit.info['public-address']))
23 self.assertEqual(page.status_code, 200)
24 # Now you can use self.d.sentry[SERVICE][UNIT] to address each of the units and perform
25 # more in-depth steps. Each self.d.sentry[SERVICE][UNIT] has the following methods:
26 # - .info - An array of the information of that unit from Juju
27 # - .file(PATH) - Get the details of a file on that unit
28 # - .file_contents(PATH) - Get plain text output of PATH file from that unit
29 # - .directory(PATH) - Get details of directory
30 # - .directory_contents(PATH) - List files and folders in PATH on that unit
31 # - .relation(relation, service:rel) - Get relation data from return service