diff options
| author | Mario Splivalo <mario.splivalo@canonical.com> | 2014-12-10 12:36:14 -0300 |
|---|---|---|
| committer | Jorge Niedbalski <jorge.niedbalski@canonical.com> | 2014-12-10 12:36:14 -0300 |
| commit | 98af8ec0ee780e6baeb76500516d6366d0ace021 (patch) | |
| tree | b16802535d9e2b2a73a4effd65285894766c2bf6 /tests | |
| parent | e77cd07116a47872845429a6ea86016ceec67927 (diff) | |
| parent | 1c8726769185095620452887493f54ec3562bf60 (diff) | |
[mariosplivalo, r=niedbalski] Upgrades charmhelpers, and adds contrib.hahelpers.cluster, make lint fixes.
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/01_deploy_single.py | 40 | ||||
| -rwxr-xr-x | tests/02_deploy_shard_test.py (renamed from tests/01_deploy_test.py) | 0 | ||||
| -rwxr-xr-x | tests/50_relate_ceilometer_test.py (renamed from tests/02_relate_ceilometer_test.py) | 0 |
3 files changed, 40 insertions, 0 deletions
diff --git a/tests/01_deploy_single.py b/tests/01_deploy_single.py new file mode 100755 index 0000000..e9afd6a --- /dev/null +++ b/tests/01_deploy_single.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python3 + +import amulet +from pymongo import MongoClient + +seconds = 900 + +d = amulet.Deployment(series='trusty') +d.add('mongodb', charm='mongodb') +d.expose('mongodb') + +# Perform the setup for the deployment. +try: + d.setup(seconds) + d.sentry.wait(seconds) +except amulet.helpers.TimeoutError: + message = 'The environment did not setup in %d seconds.', seconds + amulet.raise_status(amulet.SKIP, msg=message) +except: + raise + + +############################################################ +# Validate connectivity from $WORLD +############################################################# +def validate_world_connectivity(): + client = MongoClient(d.sentry.unit['mongodb/0'].info['public-address']) + + db = client['test'] + # Can we successfully insert? + insert_id = db.amulet.insert({'assert': True}) + if insert_id is None: + amulet.raise_status(amulet.FAIL, msg="Failed to insert test data") + # Can we delete from a shard using the Mongos hub? + result = db.amulet.remove(insert_id) + if result['err'] is not None: + amulet.raise_status(amulet.FAIL, msg="Failed to remove test data") + + +validate_world_connectivity() diff --git a/tests/01_deploy_test.py b/tests/02_deploy_shard_test.py index b32c687..b32c687 100755 --- a/tests/01_deploy_test.py +++ b/tests/02_deploy_shard_test.py diff --git a/tests/02_relate_ceilometer_test.py b/tests/50_relate_ceilometer_test.py index b5ff2e5..b5ff2e5 100755 --- a/tests/02_relate_ceilometer_test.py +++ b/tests/50_relate_ceilometer_test.py |
