charm-plumgrid-edge/tests/14-juno
2015-05-26 14:50:55 -07:00

56 lines
1.9 KiB
Python
Executable File

#!/usr/bin/env python3
import amulet
import requests
import unittest
class TestDeployment(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.deployment = amulet.Deployment(series='trusty')
cls.deployment.load_bundle_file(
bundle_file='files/plumgrid-director.yaml',
deployment_name='test')
try:
cls.deployment.setup(timeout=2000)
cls.deployment.sentry.wait()
except amulet.helpers.TimeoutError:
amulet.raise_status(
amulet.SKIP, msg="Environment wasn't stood up in time")
except:
raise
cls.pg_sentry = cls.deployment.sentry['plumgrid-director/0']
def test_plumgrid_director_gui(self):
pg_options = self.deployment.services['plumgrid-director']['options']
pg_vip = pg_options['plumgrid-virtual-ip']
if not pg_vip:
amulet.raise_status(
amulet.FAIL, msg='plumgrid virtual ip was not found.')
gui_req = requests.get(
"https://{}/".format(pg_vip), verify=False)
if not gui_req.ok:
amulet.raise_status(
amulet.FAIL, msg='unable to access plumgrid gui.')
def test_plumgrid_director_started(self):
pg_sentry = self.deployment.sentry['plumgrid-director/0']
agent_state = pg_sentry.info['agent-state']
if agent_state != 'started':
amulet.raise_status(
amulet.FAIL,
msg='plumgrid director is not in a started state')
def test_plumgrid_director_relation(self):
pg_sentry = self.deployment.sentry['plumgrid-director/0']
relation = pg_sentry.relation(
'plumgrid-plugin', 'neutron-iovisor:plumgrid-plugin')
if not relation['private-address']:
amulet.raise_status(
amulet.FAIL,
msg='Relation not found.')
if __name__ == '__main__':
unittest.main()