Files
openstack-armada-app/python3-k8sapp-openstack/k8sapp_openstack/k8sapp_openstack/tests/helm/test_keystone.py
Leonardo Fagundes Luz Serrano 7f5244e6a1 Standardize app configs (re-submission)
This is a re-submission of [1], which was reverted due to
issues with centos builds. This change can merge now that
centos is no longer supported.

Fixed versioning and adjusted some build files
to bring them as close to a standard as possible.

- Removed centos files
- Fixed mismatch in plugin name, set to python3-k8sapp-<app>
- Standardized plugin debian files (rules, *.install)

Note:
- Version tracking changes made in [1] were not added here
  as they are addressed in a different commit

[1] https://review.opendev.org/c/starlingx/openstack-armada-app/+/868294

Test Plan:
PASS build-pkgs
PASS wheel version updated

Story: 2010542
Task: 47515

Signed-off-by: Leonardo Fagundes Luz Serrano <Leonardo.FagundesLuzSerrano@windriver.com>
Change-Id: Id696b3b7f60aa92421da3545d712d85fd6b0bdeb
2023-02-24 18:19:38 +00:00

126 lines
4.1 KiB
Python

#
# Copyright (c) 2020 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
import mock
from oslo_utils import uuidutils
from sysinv.common import constants
from sysinv.helm import common
from sysinv.tests.db import base as dbbase
from sysinv.tests.db import utils as dbutils
from sysinv.tests.helm import base
from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import keystone
from k8sapp_openstack.tests import test_plugins
class KeystoneHelmTestCase(test_plugins.K8SAppOpenstackAppMixin,
base.HelmTestCaseMixin):
def setUp(self):
super(KeystoneHelmTestCase, self).setUp()
self.app = dbutils.create_test_app(name=self.app_name)
class KeystoneGetOverrideTest(KeystoneHelmTestCase,
dbbase.ControllerHostTestCase):
def test_keystone_overrides(self):
overrides = self.operator.get_helm_chart_overrides(
app_constants.HELM_CHART_KEYSTONE,
cnamespace=common.HELM_NS_OPENSTACK)
self.assertOverridesParameters(overrides, {
'pod': {},
'endpoints': {
'identity': {
'host_fqdn_override': {
'public': {},
},
},
},
'conf': {},
'network': {},
})
@mock.patch('os.path.exists', return_value=True)
@mock.patch('six.moves.builtins.open', mock.mock_open(read_data="fake"))
@mock.patch('k8sapp_openstack.utils.https_enabled', return_value=True)
def test_keystone_overrides_https_enabled(self, *_):
self.dbapi.certificate_create(
{
"id": 1,
"uuid": uuidutils.generate_uuid(),
"certtype": constants.CERT_MODE_OPENSTACK,
"signature": "abcdef",
}
)
self.dbapi.certificate_create(
{
"id": 2,
"uuid": uuidutils.generate_uuid(),
"certtype": constants.CERT_MODE_OPENSTACK_CA,
"signature": "abcdef",
}
)
self.dbapi.certificate_create(
{
"id": 3,
"uuid": uuidutils.generate_uuid(),
"certtype": constants.CERT_MODE_SSL_CA,
"signature": "abcdef",
}
)
overrides = self.operator.get_helm_chart_overrides(
app_constants.HELM_CHART_KEYSTONE,
cnamespace=common.HELM_NS_OPENSTACK)
self.assertOverridesParameters(overrides, {
'endpoints': {
'identity': {
'auth': {
'admin': {
'cacert': keystone.KeystoneHelm.get_ca_file(),
'password': mock.ANY,
'region_name': mock.ANY,
},
'test': {
'cacert': keystone.KeystoneHelm.get_ca_file(),
'password': mock.ANY,
'region_name': mock.ANY,
},
'stx_admin': {
'cacert': keystone.KeystoneHelm.get_ca_file(),
'password': mock.ANY,
'region_name': mock.ANY,
},
},
'host_fqdn_override': {
'public': {
# 'host': mock.ANY,
'tls': {
'ca': 'fake',
'crt': 'fake',
'key': 'fake',
},
},
},
},
},
'manifests': {
'certificates': True,
},
'secrets': {
'tls': {
'identity': {
'api': {
'internal': 'keystone-tls-public',
},
},
},
},
})