~jshieh/charms/trusty/xcat/1428813

« back to all changes in this revision

Viewing changes to charms/trusty/gpfs/tests/10-deploy

  • Committer: Michael Chase-Salerno
  • Date: 2015-01-16 16:16:45 UTC
  • Revision ID: bratac@linux.vnet.ibm.com-20150116161645-wvh0sllwqgyilelw
Initial GPFS charm

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python3
 
2
 
 
3
import amulet
 
4
import requests
 
5
 
 
6
d = amulet.Deployment()
 
7
 
 
8
d.add('gpfs')
 
9
d.expose('gpfs')
 
10
 
 
11
try:
 
12
    d.setup(timeout=900)
 
13
    d.sentry.wait()
 
14
except amulet.helpers.TimeoutError:
 
15
    amulet.raise_status(amulet.SKIP, msg="Environment wasn't stood up in time")
 
16
except:
 
17
    raise
 
18
 
 
19
unit = d.sentry.unit['gpfs/0']
 
20
 
 
21
# test we can access over http
 
22
page = requests.get('http://{}'.format(unit.info['public-address']))
 
23
page.raise_for_status()
 
24
 
 
25
 
 
26
# Now you can use d.sentry.unit[UNIT] to address each of the units and perform
 
27
# more in-depth steps. There are three test statuses: amulet.PASS, amulet.FAIL,
 
28
# and amulet.SKIP - these can be triggered with amulet.raise_status(). Each
 
29
# d.sentry.unit[] has the following methods:
 
30
# - .info - An array of the information of that unit from Juju
 
31
# - .file(PATH) - Get the details of a file on that unit
 
32
# - .file_contents(PATH) - Get plain text output of PATH file from that unit
 
33
# - .directory(PATH) - Get details of directory
 
34
# - .directory_contents(PATH) - List files and folders in PATH on that unit
 
35
# - .relation(relation, service:rel) - Get relation data from return service