Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(661)

Side by Side Diff: tests/100-deploy

Issue 54280047: Adds basic amulet tests
Patch Set: Created 10 years, 1 month ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests/00-setup ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/python3
2 import amulet
3
4 ###########################################################
5 # Test Quick Config
6 ###########################################################
7 scale = 2
8 block_size = "8M"
9 verify_size = 8000000
10 ###########################################################
11 # Deployment Setup
12 ###########################################################
13 d = amulet.Deployment()
14
15 #The NFS charm's presently only accept a single NFS host, and
16 # deny incoming changes based on subsequent NFS relations.
17 # test a single front end scale out operation
18 d.add('owncloud', charm='cs:precise/owncloud-8', units=2)
19 d.add('nfs', charm='cs:precise/nfs-3', units=1)
20 d.configure('owncloud', {'user': 'tom', 'password': 'swordfish'})
21 d.relate('nfs:nfs', 'owncloud:shared-fs')
22
23 try:
24 d.setup(timeout=1500)
25 d.sentry.wait()
26 except amulet.helpers.TimeoutError:
27 amulet.raise_status(amulet.SKIP, msg="Environment wasn't stood up in time")
28 except:
29 raise
30
31
32 # Define Sentries - add owncloud by default
33 sentries = {'owncloud': d.sentry.unit['owncloud/0'],
34 'owncloud2': d.sentry.unit['owncloud/1'],
35 'nfs': d.sentry.unit['nfs/0']}
36
37 ###########################################################
38 # Validate FileSystem Existance
39 ###########################################################
40 # Cache Relationship details
41 nfs_relation = sentries['nfs'].relation('nfs', 'owncloud:shared-fs')
42 # Raises an error if the directory does not exist
43 dir_stats = sentries['owncloud'].directory('/var/lib/owncloud')
44 #Fetch the contents of mtab for data validation
45 mtab_contents = sentries['owncloud'].file_contents('/etc/mtab')
46
47
48 def nfs_term_search(output, term):
49 if output.find(term) == -1:
50 amulet.raise_status(amulet.FAIL, msg="Unable to validate NFS export moun ted with %s" % term)
51
52
53 #{'fstype': 'nfs', 'private-address': '10.71.152.26', 'mountpoint': '/srv/data/r elation-sentry', 'options': 'rsize=8192,wsize=8192'}
54 nfs_term_search(mtab_contents, nfs_relation['private-address'])
55 nfs_term_search(mtab_contents, nfs_relation['fstype'])
56 nfs_term_search(mtab_contents, nfs_relation['mountpoint'])
57 nfs_term_search(mtab_contents, nfs_relation['options'])
58
59 ###########################################################
60 # Validate file write pipeline
61 ###########################################################
62 #Build a $block_size file, and ship it via NFS
63 cmd_builder = "dd if=/dev/zero of=/var/lib/owncloud/amulet-file-test bs=%s count =1" % block_size
64 sentries['owncloud'].run(cmd_builder)
65
66 file_test = sentries['nfs'].file('/srv/data/relation-sentry/amulet-file-test')
67 if file_test['size'] < verify_size:
68 amulet.raise_status(amulet.FAIL, 'File size constraint not met')
69 file_test = sentries['owncloud2'].file('/var/lib/owncloud/amulet-file-test')
70 if file_test['size'] < verify_size:
71 amulet.raise_status(amulet.FAIL, 'File size constraint not met')
OLDNEW
« no previous file with comments | « tests/00-setup ('k') | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b