When running unit tests against the master branch of the OpenStack Designate Bind charm the 13 tests fail with errors like the following:
unit_tests.test_lib_charm_openstack_designate_bind.TestOpenStackDesignateBind.test_get_sync_time
------------------------------------------------------------------------------------------------
Captured traceback:
~~~~~~~~~~~~~~~~~~~
Traceback (most recent call last):
File "./charm-designate-bind/unit_tests/test_lib_charm_openstack_designate_bind.py", line 112, in test_get_sync_time
designate_bind.DesignateBindCharm.singleton,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "./charm-designate-bind/.tox/py3/lib/python3.11/site-packages/charms_openstack/charm/core.py", line 386, in singleton
_singleton = get_charm_instance(release=release,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "./charm-designate-bind/.tox/py3/lib/python3.11/site-packages/charms_openstack/charm/core.py", line 199, in get_charm_instance
return (_get_charm_instance_function or default_get_charm_instance)(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "./charm-designate-bind/.tox/py3/lib/python3.11/site-packages/charms_openstack/charm/core.py", line 163, in default_get_charm_instance
cls = _releases[known_releases[-1]][package_type]
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
KeyError: "<MagicMock name='mock.contrib.openstack.utils.CompareOpenStackReleases()' id='135987910273104'>"
This failure is related to this change in charms.openstack - https://github.com/openstack/charms.openstack/commit/760f1257ef11a53e2491fda91ebf6454c1182ad3 - that added support for wrapped release names in OpenStack. That change in charms.openstack changed how obtaining OpenStack release names behaves, and the Designate Bind charm's mocking is incompatible with that change.
Fix proposed to branch: master /review. opendev. org/c/openstack /charm- designate- bind/+/ 920108
Review: https:/