X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FN2VC.git;a=blobdiff_plain;f=tests%2Fbase.py;h=aabf35972c464d814db05f2fe217bcb2c31d333a;hp=912eab90567efcf375aaf331ab39768cf2b10e34;hb=refs%2Fchanges%2F27%2F8727%2F6;hpb=b2a07f566be558a8b59b8b5dedfe8da5ae1b0132 diff --git a/tests/base.py b/tests/base.py index 912eab9..aabf359 100644 --- a/tests/base.py +++ b/tests/base.py @@ -1,4 +1,18 @@ #!/usr/bin/env python3 +# Copyright 2019 Canonical Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + import asyncio import datetime import logging @@ -94,7 +108,7 @@ def has_metrics(charm): def get_descriptor(descriptor): desc = None try: - tmp = yaml.load(descriptor) + tmp = yaml.safe_load(descriptor) # Remove the envelope root = list(tmp.keys())[0] @@ -118,6 +132,7 @@ def get_n2vc(loop=None): vca_user = os.getenv('VCA_USER', 'admin') vca_charms = os.getenv('VCA_CHARMS', None) vca_secret = os.getenv('VCA_SECRET', None) + vca_cacert = os.getenv('VCA_CACERT', None) # Get the Juju Public key juju_public_key = get_juju_public_key() @@ -148,6 +163,7 @@ def get_n2vc(loop=None): artifacts=vca_charms, loop=loop, juju_public_key=juju_public_key, + ca_cert=vca_cacert, ) return client @@ -740,8 +756,8 @@ class TestN2VC(object): ) machine_spec = { - 'host': hostname, - 'user': 'ubuntu', + 'hostname': hostname, + 'username': 'ubuntu', } await self.n2vc.DeployCharms( @@ -1131,7 +1147,8 @@ class TestN2VC(object): return True except Exception as ex: debug("execute_initial_config_primitives exception: {}".format(ex)) - + raise ex + return False @classmethod