diff --git a/build-requirements.txt b/build-requirements.txt deleted file mode 100644 index b6d2452f..00000000 --- a/build-requirements.txt +++ /dev/null @@ -1,7 +0,0 @@ -# NOTES(lourot): -# * We don't install charmcraft via pip anymore because it anyway spins up a -# container and scp the system's charmcraft snap inside it. So the charmcraft -# snap is necessary on the system anyway. -# * `tox -e build` successfully validated with charmcraft 1.2.1 - -cffi==1.14.6; python_version < '3.6' # cffi 1.15.0 drops support for py35. diff --git a/charmcraft.yaml b/charmcraft.yaml index be6ec7c5..a89bb84e 100644 --- a/charmcraft.yaml +++ b/charmcraft.yaml @@ -30,9 +30,3 @@ bases: - name: ubuntu channel: "22.04" architectures: [amd64, s390x, ppc64el, arm64] - - name: ubuntu - channel: "23.04" - architectures: [amd64, s390x, ppc64el, arm64] - - name: ubuntu - channel: "23.10" - architectures: [amd64, s390x, ppc64el, arm64] diff --git a/hooks/charmhelpers/contrib/openstack/cert_utils.py b/hooks/charmhelpers/contrib/openstack/cert_utils.py index a25ca995..6620f59f 100644 --- a/hooks/charmhelpers/contrib/openstack/cert_utils.py +++ b/hooks/charmhelpers/contrib/openstack/cert_utils.py @@ -414,18 +414,27 @@ def get_requests_for_local_unit(relation_name=None): is_legacy_request = set(sent).intersection(legacy_keys) for unit in related_units(rid): data = relation_get(rid=rid, unit=unit) - if data.get(raw_certs_key): - bundles.append({ - 'ca': data['ca'], - 'chain': data.get('chain'), - 'certs': json.loads(data[raw_certs_key])}) - elif is_legacy_request: - bundles.append({ - 'ca': data['ca'], - 'chain': data.get('chain'), - 'certs': {sent['common_name']: - {'cert': data.get(local_name + '.server.cert'), - 'key': data.get(local_name + '.server.key')}}}) + # Note: Bug#2028683 - data may not be available if the certificates + # relation hasn't been populated by the providing charm. If no 'ca' + # in the data then don't attempt the bundle at all. + if data.get('ca'): + if data.get(raw_certs_key): + bundles.append({ + 'ca': data['ca'], + 'chain': data.get('chain'), + 'certs': json.loads(data[raw_certs_key]) + }) + elif is_legacy_request: + bundles.append({ + 'ca': data['ca'], + 'chain': data.get('chain'), + 'certs': { + sent['common_name']: { + 'cert': data.get(local_name + '.server.cert'), + 'key': data.get(local_name + '.server.key') + } + } + }) return bundles diff --git a/hooks/charmhelpers/contrib/openstack/context.py b/hooks/charmhelpers/contrib/openstack/context.py index 24a13d0d..1e667fb0 100644 --- a/hooks/charmhelpers/contrib/openstack/context.py +++ b/hooks/charmhelpers/contrib/openstack/context.py @@ -545,7 +545,7 @@ class IdentityServiceContext(OSContextGenerator): 'internal_auth_url': internal_auth_url, }) - # we keep all veriables in ctxt for compatibility and + # we keep all variables in ctxt for compatibility and # add nested dictionary for keystone_authtoken generic # templating if keystonemiddleware_os_release: @@ -557,6 +557,7 @@ class IdentityServiceContext(OSContextGenerator): # NOTE(jamespage) this is required for >= icehouse # so a missing value just indicates keystone needs # upgrading + ctxt['admin_user_id'] = _resolve('service_user_id') ctxt['admin_tenant_id'] = _resolve('service_tenant_id') ctxt['admin_domain_id'] = _resolve('service_domain_id') return ctxt @@ -1748,9 +1749,9 @@ class WSGIWorkerConfigContext(WorkerConfigContext): def __call__(self): total_processes = _calculate_workers() - enable_wsgi_rotation = config('wsgi-rotation') - if enable_wsgi_rotation is None: - enable_wsgi_rotation = True + enable_wsgi_socket_rotation = config('wsgi-socket-rotation') + if enable_wsgi_socket_rotation is None: + enable_wsgi_socket_rotation = True ctxt = { "service_name": self.service_name, "user": self.user, @@ -1764,7 +1765,7 @@ class WSGIWorkerConfigContext(WorkerConfigContext): "public_processes": int(math.ceil(self.public_process_weight * total_processes)), "threads": 1, - "wsgi_rotation": enable_wsgi_rotation, + "wsgi_socket_rotation": enable_wsgi_socket_rotation, } return ctxt diff --git a/hooks/charmhelpers/contrib/openstack/templates/wsgi-openstack-api.conf b/hooks/charmhelpers/contrib/openstack/templates/wsgi-openstack-api.conf index 2cb735e9..de5f603f 100644 --- a/hooks/charmhelpers/contrib/openstack/templates/wsgi-openstack-api.conf +++ b/hooks/charmhelpers/contrib/openstack/templates/wsgi-openstack-api.conf @@ -12,7 +12,7 @@ Listen {{ admin_port }} Listen {{ public_port }} {% endif -%} -{% if wsgi_rotation -%} +{% if wsgi_socket_rotation -%} WSGISocketRotation On {% else -%} WSGISocketRotation Off diff --git a/hooks/charmhelpers/contrib/openstack/templates/wsgi-openstack-metadata.conf b/hooks/charmhelpers/contrib/openstack/templates/wsgi-openstack-metadata.conf index 2cb735e9..de5f603f 100644 --- a/hooks/charmhelpers/contrib/openstack/templates/wsgi-openstack-metadata.conf +++ b/hooks/charmhelpers/contrib/openstack/templates/wsgi-openstack-metadata.conf @@ -12,7 +12,7 @@ Listen {{ admin_port }} Listen {{ public_port }} {% endif -%} -{% if wsgi_rotation -%} +{% if wsgi_socket_rotation -%} WSGISocketRotation On {% else -%} WSGISocketRotation Off diff --git a/hooks/charmhelpers/contrib/openstack/utils.py b/hooks/charmhelpers/contrib/openstack/utils.py index e98be2c5..da711c65 100644 --- a/hooks/charmhelpers/contrib/openstack/utils.py +++ b/hooks/charmhelpers/contrib/openstack/utils.py @@ -161,6 +161,7 @@ OPENSTACK_CODENAMES = OrderedDict([ ('2022.2', 'zed'), ('2023.1', 'antelope'), ('2023.2', 'bobcat'), + ('2024.1', 'caracal'), ]) # The ugly duckling - must list releases oldest to newest @@ -416,17 +417,6 @@ def get_os_version_codename(codename, version_map=OPENSTACK_CODENAMES, error_out(e) -def get_os_version_codename_swift(codename): - '''Determine OpenStack version number of swift from codename.''' - # for k, v in six.iteritems(SWIFT_CODENAMES): - for k, v in SWIFT_CODENAMES.items(): - if k == codename: - return v[-1] - e = 'Could not derive swift version for '\ - 'codename: %s' % codename - error_out(e) - - def get_swift_codename(version): '''Determine OpenStack codename that corresponds to swift version.''' codenames = [k for k, v in SWIFT_CODENAMES.items() if version in v] @@ -585,7 +575,6 @@ def get_installed_os_version(): return openstack_release().get('OPENSTACK_CODENAME') -@cached def openstack_release(): """Return /etc/os-release in a dict.""" d = {} @@ -847,14 +836,10 @@ def openstack_upgrade_available(package): if not cur_vers: # The package has not been installed yet do not attempt upgrade return False - if "swift" in package: - codename = get_os_codename_install_source(src) - avail_vers = get_os_version_codename_swift(codename) - else: - try: - avail_vers = get_os_version_install_source(src) - except Exception: - avail_vers = cur_vers + try: + avail_vers = get_os_version_install_source(src) + except Exception: + avail_vers = cur_vers apt.init() return apt.version_compare(avail_vers, cur_vers) >= 1 diff --git a/hooks/charmhelpers/contrib/storage/linux/ceph.py b/hooks/charmhelpers/contrib/storage/linux/ceph.py index 2e1fc1b5..6ec67cba 100644 --- a/hooks/charmhelpers/contrib/storage/linux/ceph.py +++ b/hooks/charmhelpers/contrib/storage/linux/ceph.py @@ -158,15 +158,19 @@ def get_osd_settings(relation_name): return _order_dict_by_key(osd_settings) -def send_application_name(relid=None): +def send_application_name(relid=None, app_name=None): """Send the application name down the relation. :param relid: Relation id to set application name in. :type relid: str + :param app_name: Application name to send in the relation. + :type app_name: str """ + if app_name is None: + app_name = application_name() relation_set( relation_id=relid, - relation_settings={'application-name': application_name()}) + relation_settings={'application-name': app_name}) def send_osd_settings(): diff --git a/hooks/charmhelpers/contrib/storage/linux/lvm.py b/hooks/charmhelpers/contrib/storage/linux/lvm.py index d0a57211..0d294c79 100644 --- a/hooks/charmhelpers/contrib/storage/linux/lvm.py +++ b/hooks/charmhelpers/contrib/storage/linux/lvm.py @@ -17,8 +17,6 @@ from subprocess import ( CalledProcessError, check_call, check_output, - Popen, - PIPE, ) @@ -58,9 +56,7 @@ def remove_lvm_physical_volume(block_device): :param block_device: str: Full path of block device to scrub. ''' - p = Popen(['pvremove', '-ff', block_device], - stdin=PIPE) - p.communicate(input='y\n') + check_call(['pvremove', '-ff', '--yes', block_device]) def list_lvm_volume_group(block_device): diff --git a/hooks/charmhelpers/core/unitdata.py b/hooks/charmhelpers/core/unitdata.py index 8f4bbc61..65153f1f 100644 --- a/hooks/charmhelpers/core/unitdata.py +++ b/hooks/charmhelpers/core/unitdata.py @@ -151,6 +151,7 @@ import contextlib import datetime import itertools import json +import logging import os import pprint import sqlite3 @@ -521,6 +522,42 @@ _KV = None def kv(): global _KV + + # If we are running unit tests, it is useful to go into memory-backed KV store to + # avoid concurrency issues when running multiple tests. This is not a + # problem when juju is running normally. + + env_var = os.environ.get("CHARM_HELPERS_TESTMODE", "auto").lower() + if env_var not in ["auto", "no", "yes"]: + logging.warning("Unknown value for CHARM_HELPERS_TESTMODE '%s'" + ", assuming 'no'", env_var) + env_var = "no" + + if env_var == "no": + in_memory_db = False + elif env_var == "yes": + in_memory_db = True + elif env_var == "auto": + # If UNIT_STATE_DB is set, respect this request + if "UNIT_STATE_DB" in os.environ: + in_memory_db = False + # Autodetect normal juju execution by looking for juju variables + elif "JUJU_CHARM_DIR" in os.environ or "JUJU_UNIT_NAME" in os.environ: + in_memory_db = False + else: + # We are probably running in unit test mode + logging.warning("Auto-detected unit test environment for KV store.") + in_memory_db = True + else: + # Help the linter realise that in_memory_db is always set + raise Exception("Cannot reach this line") + if _KV is None: - _KV = Storage() + if in_memory_db: + _KV = Storage(":memory:") + else: + _KV = Storage() + else: + if in_memory_db and _KV.db_path != ":memory:": + logging.warning("Running with in_memory_db and KV is not set to :memory:") return _KV diff --git a/hooks/charmhelpers/fetch/snap.py b/hooks/charmhelpers/fetch/snap.py index 36d6bce9..7ab7ce3e 100644 --- a/hooks/charmhelpers/fetch/snap.py +++ b/hooks/charmhelpers/fetch/snap.py @@ -52,7 +52,7 @@ def _snap_exec(commands): :param commands: List commands :return: Integer exit code """ - assert type(commands) == list + assert isinstance(commands, list) retry_count = 0 return_code = None diff --git a/hooks/charmhelpers/fetch/ubuntu.py b/hooks/charmhelpers/fetch/ubuntu.py index 1be992c4..d0089eb7 100644 --- a/hooks/charmhelpers/fetch/ubuntu.py +++ b/hooks/charmhelpers/fetch/ubuntu.py @@ -246,6 +246,14 @@ CLOUD_ARCHIVE_POCKETS = { 'bobcat/proposed': 'jammy-proposed/bobcat', 'jammy-bobcat/proposed': 'jammy-proposed/bobcat', 'jammy-proposed/bobcat': 'jammy-proposed/bobcat', + # caracal + 'caracal': 'jammy-updates/caracal', + 'jammy-caracal': 'jammy-updates/caracal', + 'jammy-caracal/updates': 'jammy-updates/caracal', + 'jammy-updates/caracal': 'jammy-updates/caracal', + 'caracal/proposed': 'jammy-proposed/caracal', + 'jammy-caracal/proposed': 'jammy-proposed/caracal', + 'jammy-proposed/caracal': 'jammy-proposed/caracal', # OVN 'focal-ovn-22.03': 'focal-updates/ovn-22.03', @@ -279,6 +287,7 @@ OPENSTACK_RELEASES = ( 'zed', 'antelope', 'bobcat', + 'caracal', ) @@ -308,6 +317,7 @@ UBUNTU_OPENSTACK_RELEASE = OrderedDict([ ('kinetic', 'zed'), ('lunar', 'antelope'), ('mantic', 'bobcat'), + ('noble', 'caracal'), ]) diff --git a/hooks/charmhelpers/osplatform.py b/hooks/charmhelpers/osplatform.py index 1ace468f..5d121866 100644 --- a/hooks/charmhelpers/osplatform.py +++ b/hooks/charmhelpers/osplatform.py @@ -9,19 +9,13 @@ def get_platform(): will be returned (which is the name of the module). This string is used to decide which platform module should be imported. """ - # linux_distribution is deprecated and will be removed in Python 3.7 - # Warnings *not* disabled, as we certainly need to fix this. - if hasattr(platform, 'linux_distribution'): - tuple_platform = platform.linux_distribution() - current_platform = tuple_platform[0] - else: - current_platform = _get_platform_from_fs() + current_platform = _get_current_platform() if "Ubuntu" in current_platform: return "ubuntu" elif "CentOS" in current_platform: return "centos" - elif "debian" in current_platform: + elif "debian" in current_platform or "Debian" in current_platform: # Stock Python does not detect Ubuntu and instead returns debian. # Or at least it does in some build environments like Travis CI return "ubuntu" @@ -36,6 +30,24 @@ def get_platform(): .format(current_platform)) +def _get_current_platform(): + """Return the current platform information for the OS. + + Attempts to lookup linux distribution information from the platform + module for releases of python < 3.7. For newer versions of python, + the platform is determined from the /etc/os-release file. + """ + # linux_distribution is deprecated and will be removed in Python 3.7 + # Warnings *not* disabled, as we certainly need to fix this. + if hasattr(platform, 'linux_distribution'): + tuple_platform = platform.linux_distribution() + current_platform = tuple_platform[0] + else: + current_platform = _get_platform_from_fs() + + return current_platform + + def _get_platform_from_fs(): """Get Platform from /etc/os-release.""" with open(os.path.join(os.sep, 'etc', 'os-release')) as fin: diff --git a/metadata.yaml b/metadata.yaml index d9e56619..66e61ef6 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -16,11 +16,9 @@ description: | L2 connectivity on nova-compute services. docs: https://discourse.charmhub.io/t/neutron-openvswitch-docs-index/11001 tags: -- openstack + - openstack series: -- jammy -- lunar -- mantic + - jammy extra-bindings: data: provides: diff --git a/tests/bundles/jammy-antelope.yaml b/tests/bundles/jammy-antelope.yaml index 8b279efe..81b1e68e 100644 --- a/tests/bundles/jammy-antelope.yaml +++ b/tests/bundles/jammy-antelope.yaml @@ -75,7 +75,7 @@ applications: enable-qos: True to: - '4' - channel: latest/edge + channel: 2024.1/edge keystone: charm: ch:keystone num_units: 1 @@ -83,7 +83,7 @@ applications: openstack-origin: *openstack-origin to: - '5' - channel: latest/edge + channel: 2024.1/edge glance: charm: ch:glance num_units: 1 @@ -91,7 +91,7 @@ applications: openstack-origin: *openstack-origin to: - '6' - channel: latest/edge + channel: 2024.1/edge neutron-openvswitch: charm: ../../neutron-openvswitch.charm options: @@ -106,7 +106,7 @@ applications: openstack-origin: *openstack-origin to: - '7' - channel: latest/edge + channel: 2024.1/edge nova-compute: charm: ch:nova-compute num_units: 2 @@ -119,7 +119,7 @@ applications: to: - '8' - '9' - channel: latest/edge + channel: 2024.1/edge placement: charm: ch:placement num_units: 1 @@ -127,10 +127,7 @@ applications: openstack-origin: *openstack-origin to: - '10' - channel: latest/edge - vault-mysql-router: - charm: ch:mysql-router - channel: latest/edge + channel: 2024.1/edge vault: charm: ch:vault num_units: 1 @@ -147,7 +144,7 @@ applications: channel: latest/edge neutron-api-plugin-ovn: charm: ch:neutron-api-plugin-ovn - channel: latest/edge + channel: 2024.1/edge ovn-chassis: charm: ch:ovn-chassis options: diff --git a/tests/bundles/jammy-bobcat.yaml b/tests/bundles/jammy-bobcat.yaml index 2ec9e553..d0f72e00 100644 --- a/tests/bundles/jammy-bobcat.yaml +++ b/tests/bundles/jammy-bobcat.yaml @@ -75,7 +75,7 @@ applications: enable-qos: True to: - '4' - channel: latest/edge + channel: 2024.1/edge keystone: charm: ch:keystone num_units: 1 @@ -83,7 +83,7 @@ applications: openstack-origin: *openstack-origin to: - '5' - channel: latest/edge + channel: 2024.1/edge glance: charm: ch:glance num_units: 1 @@ -91,7 +91,7 @@ applications: openstack-origin: *openstack-origin to: - '6' - channel: latest/edge + channel: 2024.1/edge neutron-openvswitch: charm: ../../neutron-openvswitch.charm options: @@ -106,7 +106,7 @@ applications: openstack-origin: *openstack-origin to: - '7' - channel: latest/edge + channel: 2024.1/edge nova-compute: charm: ch:nova-compute num_units: 2 @@ -119,7 +119,7 @@ applications: to: - '8' - '9' - channel: latest/edge + channel: 2024.1/edge placement: charm: ch:placement num_units: 1 @@ -127,10 +127,7 @@ applications: openstack-origin: *openstack-origin to: - '10' - channel: latest/edge - vault-mysql-router: - charm: ch:mysql-router - channel: latest/edge + channel: 2024.1/edge vault: charm: ch:vault num_units: 1 @@ -147,7 +144,7 @@ applications: channel: latest/edge neutron-api-plugin-ovn: charm: ch:neutron-api-plugin-ovn - channel: latest/edge + channel: 2024.1/edge ovn-chassis: charm: ch:ovn-chassis options: diff --git a/tests/bundles/mantic-bobcat.yaml b/tests/bundles/jammy-caracal.yaml similarity index 94% rename from tests/bundles/mantic-bobcat.yaml rename to tests/bundles/jammy-caracal.yaml index 1a98ced9..554da77b 100644 --- a/tests/bundles/mantic-bobcat.yaml +++ b/tests/bundles/jammy-caracal.yaml @@ -1,7 +1,7 @@ variables: - openstack-origin: &openstack-origin distro + openstack-origin: &openstack-origin cloud:jammy-caracal -series: &series mantic +series: &series jammy machines: 0: @@ -75,7 +75,7 @@ applications: enable-qos: True to: - '4' - channel: latest/edge + channel: 2024.1/edge keystone: charm: ch:keystone num_units: 1 @@ -83,7 +83,7 @@ applications: openstack-origin: *openstack-origin to: - '5' - channel: latest/edge + channel: 2024.1/edge glance: charm: ch:glance num_units: 1 @@ -91,7 +91,7 @@ applications: openstack-origin: *openstack-origin to: - '6' - channel: latest/edge + channel: 2024.1/edge neutron-openvswitch: charm: ../../neutron-openvswitch.charm options: @@ -106,7 +106,7 @@ applications: openstack-origin: *openstack-origin to: - '7' - channel: latest/edge + channel: 2024.1/edge nova-compute: charm: ch:nova-compute num_units: 2 @@ -119,7 +119,7 @@ applications: to: - '8' - '9' - channel: latest/edge + channel: 2024.1/edge placement: charm: ch:placement num_units: 1 @@ -127,10 +127,7 @@ applications: openstack-origin: *openstack-origin to: - '10' - channel: latest/edge - vault-mysql-router: - charm: ch:mysql-router - channel: latest/edge + channel: 2024.1/edge vault: charm: ch:vault num_units: 1 @@ -147,7 +144,7 @@ applications: channel: latest/edge neutron-api-plugin-ovn: charm: ch:neutron-api-plugin-ovn - channel: latest/edge + channel: 2024.1/edge ovn-chassis: charm: ch:ovn-chassis options: diff --git a/tests/bundles/lunar-antelope.yaml b/tests/bundles/noble-caracal.yaml similarity index 95% rename from tests/bundles/lunar-antelope.yaml rename to tests/bundles/noble-caracal.yaml index e379b0c3..046e571d 100644 --- a/tests/bundles/lunar-antelope.yaml +++ b/tests/bundles/noble-caracal.yaml @@ -1,7 +1,7 @@ variables: openstack-origin: &openstack-origin distro -series: &series lunar +series: &series noble machines: 0: @@ -75,7 +75,7 @@ applications: enable-qos: True to: - '4' - channel: latest/edge + channel: 2024.1/edge keystone: charm: ch:keystone num_units: 1 @@ -83,7 +83,7 @@ applications: openstack-origin: *openstack-origin to: - '5' - channel: latest/edge + channel: 2024.1/edge glance: charm: ch:glance num_units: 1 @@ -91,7 +91,7 @@ applications: openstack-origin: *openstack-origin to: - '6' - channel: latest/edge + channel: 2024.1/edge neutron-openvswitch: charm: ../../neutron-openvswitch.charm options: @@ -106,7 +106,7 @@ applications: openstack-origin: *openstack-origin to: - '7' - channel: latest/edge + channel: 2024.1/edge nova-compute: charm: ch:nova-compute num_units: 2 @@ -119,7 +119,7 @@ applications: to: - '8' - '9' - channel: latest/edge + channel: 2024.1/edge placement: charm: ch:placement num_units: 1 @@ -127,10 +127,7 @@ applications: openstack-origin: *openstack-origin to: - '10' - channel: latest/edge - vault-mysql-router: - charm: ch:mysql-router - channel: latest/edge + channel: 2024.1/edge vault: charm: ch:vault num_units: 1 @@ -147,7 +144,7 @@ applications: channel: latest/edge neutron-api-plugin-ovn: charm: ch:neutron-api-plugin-ovn - channel: latest/edge + channel: 2024.1/edge ovn-chassis: charm: ch:ovn-chassis options: diff --git a/tests/tests.yaml b/tests/tests.yaml index a446bddf..64c6afde 100644 --- a/tests/tests.yaml +++ b/tests/tests.yaml @@ -6,16 +6,13 @@ charm_name: neutron-openvswitch # OVS to OVN. smoke_bundles: - - jammy-antelope - + - jammy-caracal gate_bundles: - jammy-antelope - -dev_bundles: - jammy-bobcat - - lunar-antelope - - mantic-bobcat - + - jammy-caracal +dev_bundles: + - noble-caracal configure: - zaza.openstack.charm_tests.vault.setup.auto_initialize_no_validation - zaza.openstack.charm_tests.glance.setup.add_lts_image @@ -57,5 +54,4 @@ tests_options: # allows verifying instances survive a SDN migration. zaza.openstack.charm_tests.neutron.tests.NeutronNetworkingTest.test_instances_have_networking.run_resource_cleanup: false force_deploy: - - lunar-antelope-dvr-snat - - mantic-bobcat-dvr-snat + - noble-caracal diff --git a/tox.ini b/tox.ini index 2cb6ca16..57c2f4ec 100644 --- a/tox.ini +++ b/tox.ini @@ -32,11 +32,13 @@ passenv = CS_* OS_* TEST_* -deps = -r{toxinidir}/test-requirements.txt +deps = + -c {env:TEST_CONSTRAINTS_FILE:https://raw.githubusercontent.com/openstack-charmers/zaza-openstack-tests/master/constraints/constraints-2024.1.txt} + -r{toxinidir}/test-requirements.txt [testenv:build] basepython = python3 -deps = -r{toxinidir}/build-requirements.txt +deps = # charmcraft clean is done to ensure that # `tox -e build` always performs a clean, repeatable build. # For faster rebuilds during development, @@ -49,12 +51,16 @@ commands = [testenv:py310] basepython = python3.10 -deps = -r{toxinidir}/requirements.txt +deps = + -c {env:TEST_CONSTRAINTS_FILE:https://raw.githubusercontent.com/openstack-charmers/zaza-openstack-tests/master/constraints/constraints-2024.1.txt} + -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt [testenv:py3] basepython = python3 -deps = -r{toxinidir}/requirements.txt +deps = + -c {env:TEST_CONSTRAINTS_FILE:https://raw.githubusercontent.com/openstack-charmers/zaza-openstack-tests/master/constraints/constraints-2024.1.txt} + -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt [testenv:pep8] @@ -68,7 +74,9 @@ commands = flake8 {posargs} hooks unit_tests tests actions lib files # Technique based heavily upon # https://github.com/openstack/nova/blob/master/tox.ini basepython = python3 -deps = -r{toxinidir}/requirements.txt +deps = + -c {env:TEST_CONSTRAINTS_FILE:https://raw.githubusercontent.com/openstack-charmers/zaza-openstack-tests/master/constraints/constraints-2024.1.txt} + -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt setenv = {[testenv]setenv} diff --git a/unit_tests/test_neutron_ovs_context.py b/unit_tests/test_neutron_ovs_context.py index 86e87bc2..21788b2f 100644 --- a/unit_tests/test_neutron_ovs_context.py +++ b/unit_tests/test_neutron_ovs_context.py @@ -198,6 +198,7 @@ class OVSPluginContextTest(CharmTestCase): } self.assertEqual(expect, napi_ctxt()) + @patch.object(context, 'is_container') @patch.object(charmhelpers.contrib.openstack.utils, 'get_os_codename_package') @patch.object(charmhelpers.contrib.openstack.context, 'relation_get') @@ -218,7 +219,8 @@ class OVSPluginContextTest(CharmTestCase): _local_address, _config, _runits, _rids, _rget, - _get_os_cdnm_pkg): + _get_os_cdnm_pkg, + _is_container): def mock_npa(plugin, section, manager): if section == "driver": return "neutron.randomdriver" @@ -243,6 +245,7 @@ class OVSPluginContextTest(CharmTestCase): } _rget.side_effect = lambda *args, **kwargs: rdata self.get_host_ip.return_value = '127.0.0.15' + _is_container.return_value = False napi_ctxt = context.OVSPluginContext() expect = { 'distributed_routing': False,