From 6d0a59802bd676f4b8565bc005dc94c6cc97ed57 Mon Sep 17 00:00:00 2001 From: "camille.rodriguez" Date: Thu, 20 Aug 2020 11:35:38 -0500 Subject: [PATCH] fix merge conflict --- zaza/openstack/charm_tests/gnocchi/tests.py | 73 ++++++++++----------- 1 file changed, 35 insertions(+), 38 deletions(-) diff --git a/zaza/openstack/charm_tests/gnocchi/tests.py b/zaza/openstack/charm_tests/gnocchi/tests.py index 808f374..5147486 100644 --- a/zaza/openstack/charm_tests/gnocchi/tests.py +++ b/zaza/openstack/charm_tests/gnocchi/tests.py @@ -16,15 +16,12 @@ """Encapsulate Gnocchi testing.""" -import base64 import boto3 import logging import pprint from gnocchiclient.v1 import client as gnocchi_client -import zaza.model as model import zaza.openstack.charm_tests.test_utils as test_utils -import zaza.openstack.utilities as utilities import zaza.openstack.utilities.openstack as openstack_utils @@ -65,41 +62,6 @@ class GnocchiTest(test_utils.OpenStackBaseTest): logging.info("Testing pause and resume") -class GnocchiExternalCATest(test_utils.OpenStackBaseTest): - """Test Gnocchi for external root CA config option.""" - - def test_upload_external_cert(self): - """Verify that the external CA is uploaded correctly.""" - logging.info('Changing value for trusted-external-ca-cert.') - ca_cert_option = 'trusted-external-ca-cert' - ppk, cert = utilities.cert.generate_cert('gnocchi_test.ci.local') - b64_cert = base64.b64encode(cert).decode() - config = { - ca_cert_option: b64_cert, - } - model.set_application_config( - 'gnocchi', - config - ) - model.block_until_all_units_idle() - - cert_location = '/usr/local/share/ca-certificates' - cert_name = 'gnocchi-external.crt' - cmd = 'ls ' + cert_location + '/' + cert_name - logging.info("Validating that the file {} is created in \ - {}".format(cert_name, cert_location)) - result = model.run_on_unit('gnocchi/0', cmd) - self.assertEqual(result['Code'], '0') - - linked_cert_location = '/etc/ssl/certs' - linked_cert_name = 'gnocchi-external.pem' - cmd = 'ls ' + linked_cert_location + '/' + linked_cert_name - logging.info("Validating that the link {} is created in \ - {}".format(linked_cert_name, linked_cert_location)) - result = model.run_on_unit('gnocchi/0', cmd) - self.assertEqual(result['Code'], '0') - - class GnocchiS3Test(test_utils.OpenStackBaseTest): """Test Gnocchi for S3 storage backend.""" @@ -148,3 +110,38 @@ class GnocchiS3Test(test_utils.OpenStackBaseTest): break else: AssertionError('Bucket "{}" not found'.format(gnocchi_bkt)) + + +class GnocchiExternalCATest(test_utils.OpenStackBaseTest): + """Test Gnocchi for external root CA config option.""" + + def test_upload_external_cert(self): + """Verify that the external CA is uploaded correctly.""" + logging.info('Changing value for trusted-external-ca-cert.') + ca_cert_option = 'trusted-external-ca-cert' + ppk, cert = utilities.cert.generate_cert('gnocchi_test.ci.local') + b64_cert = base64.b64encode(cert).decode() + config = { + ca_cert_option: b64_cert, + } + model.set_application_config( + 'gnocchi', + config + ) + model.block_until_all_units_idle() + + cert_location = '/usr/local/share/ca-certificates' + cert_name = 'gnocchi-external.crt' + cmd = 'ls ' + cert_location + '/' + cert_name + logging.info("Validating that the file {} is created in \ + {}".format(cert_name, cert_location)) + result = model.run_on_unit('gnocchi/0', cmd) + self.assertEqual(result['Code'], '0') + + linked_cert_location = '/etc/ssl/certs' + linked_cert_name = 'gnocchi-external.pem' + cmd = 'ls ' + linked_cert_location + '/' + linked_cert_name + logging.info("Validating that the link {} is created in \ + {}".format(linked_cert_name, linked_cert_location)) + result = model.run_on_unit('gnocchi/0', cmd) + self.assertEqual(result['Code'], '0') \ No newline at end of file