Skip to content

Commit

Permalink
Remove storage setup for caas ci test, Shorter timeout because mediaw…
Browse files Browse the repository at this point in the history
…iki is faster
  • Loading branch information
ycliuhw committed May 6, 2019
1 parent b52d3eb commit c1e1fa5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 21 deletions.
27 changes: 7 additions & 20 deletions acceptancetests/assess_caas_deploy_charms.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,46 +67,33 @@ def assess_caas_charm_deployment(caas_client):
model_name = 'testcaas'
k8s_model = caas_client.add_model(model_name)

sc_name = caas_client.default_storage_class_name
# ensure storage pools for caas operator using default sc.
k8s_model.juju(
'create-storage-pool',
('operator-storage', 'kubernetes', 'storage-class=%s' % sc_name)
)

# ensure storage pools for mariadb
# TODO(ycliuhw): remove storage-pool setup, because Juju takes care of it now.
# And add tests for deploy with & without storage setup.
mariadb_storage_pool_name = 'mariadb-pv'
k8s_model.juju(
'create-storage-pool',
(mariadb_storage_pool_name, 'kubernetes', 'storage-class=%s' % sc_name)
)

k8s_model.deploy(
charm="cs:~juju/mediawiki-k8s-3",
config='juju-external-hostname={}'.format(external_hostname),
)

k8s_model.deploy(
charm="cs:~juju/mariadb-k8s-0",
storage='database=100M,{}'.format(mariadb_storage_pool_name),
)

k8s_model.juju('relate', ('mediawiki-k8s:db', 'mariadb-k8s:server'))
k8s_model.juju('expose', ('mediawiki-k8s',))
k8s_model.wait_for_workloads(timeout=3600)
k8s_model.wait_for_workloads(timeout=600)

def success_hook():
log.info(caas_client.kubectl('get', 'all', '--all-namespaces'))

def fail_hook():
success_hook()
log.info(caas_client.kubectl('get', 'pv,pvc', '-n', model_name))
caas_client.ensure_cleanup()

url = '{}://{}/{}'.format('http', external_hostname, 'mediawiki-k8s')
url = '{}://{}'.format(
'http', external_hostname,
# 'mediawiki-k8s', # TODO(ycliuhw): enable relative path once problem solved.
)
check_app_healthy(
url, timeout=1800,
url, timeout=300,
success_hook=success_hook,
fail_hook=fail_hook,
)
Expand Down
4 changes: 3 additions & 1 deletion acceptancetests/jujupy/k8s_provider/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,13 @@ def ensure_cleanup(self):
namespaces = json.loads(
self.kubectl('get', 'ns', '-o', 'json')
)
logger.info("all namespaces namespaces: %s", namespaces)
juju_owned_ns = [
ns['metadata']['name']
for ns in namespaces
for ns in namespaces['items']
if ns['metadata'].get('annotations', {}).get('juju.io/controller') == controller_uuid
]
logger.info("juju owned namespaces: %s", juju_owned_ns)
for ns_name in juju_owned_ns:
logger.info("deleting namespace: %s", ns_name)
try:
Expand Down

0 comments on commit c1e1fa5

Please sign in to comment.