diff --git a/lib/charms/mongodb/v1/config_server_interface.py b/lib/charms/mongodb/v0/config_server_interface.py similarity index 98% rename from lib/charms/mongodb/v1/config_server_interface.py rename to lib/charms/mongodb/v0/config_server_interface.py index af89180bc..cdaa8c974 100644 --- a/lib/charms/mongodb/v1/config_server_interface.py +++ b/lib/charms/mongodb/v0/config_server_interface.py @@ -8,7 +8,6 @@ """ import logging - from ops.charm import CharmBase, EventBase from ops.framework import Object from ops.model import WaitingStatus @@ -22,14 +21,14 @@ CONFIG_SERVER_URI_KEY = "config-server-uri" # The unique Charmhub library identifier, never change it -LIBID = "55fee8fa73364fb0a2dc16a954b2fd4a" +LIBID = "58ad1ccca4974932ba22b97781b9b2a0" # Increment this major API version when introducing breaking changes -LIBAPI = 1 +LIBAPI = 0 # Increment this PATCH version before using `charmcraft publish-lib` or reset # to 0 if you are raising the major API version -LIBPATCH = 4 +LIBPATCH = 1 class ClusterProvider(Object): diff --git a/src/charm.py b/src/charm.py index d6d38766f..75b4419f6 100755 --- a/src/charm.py +++ b/src/charm.py @@ -20,7 +20,7 @@ ) from charms.mongodb.v0.mongodb_secrets import SecretCache, generate_secret_label from charms.mongodb.v0.mongodb_tls import MongoDBTLS -from charms.mongodb.v1.config_server_interface import ClusterProvider +from charms.mongodb.v0.config_server_interface import ClusterProvider from charms.mongodb.v1.helpers import ( KEY_FILE, TLS_EXT_CA_FILE, diff --git a/tests/unit/test_config_server_lib.py b/tests/unit/test_config_server_lib.py index 1f47b2ab7..23150aaba 100644 --- a/tests/unit/test_config_server_lib.py +++ b/tests/unit/test_config_server_lib.py @@ -3,7 +3,6 @@ import unittest from unittest.mock import patch -from ops.model import BlockedStatus, ModelError from ops.testing import Harness from charm import MongodbOperatorCharm @@ -27,13 +26,14 @@ def setUp(self): def test_on_relation_joined_failed_hook_checks(self, _update_relation_data): """Tests that no relation data is set when cluster joining conditions are not met.""" - def is_role_mock_call(*args): + def is_not_config_mock_call(*args): assert args == ("config-server",) return False self.harness.charm.app_peer_data["db_initialised"] = "True" # fails due to being run on non-config-server + self.harness.charm.is_role = is_not_config_mock_call relation_id = self.harness.add_relation("cluster", "mongos") self.harness.add_relation_unit(relation_id, "mongos/0") _update_relation_data.assert_not_called() @@ -41,11 +41,11 @@ def is_role_mock_call(*args): # fails because db has not been initialized del self.harness.charm.app_peer_data["db_initialised"] - def is_role_mock_call(*args): + def is_config_mock_call(*args): assert args == ("config-server",) return True - self.harness.charm.is_role = is_role_mock_call + self.harness.charm.is_role = is_config_mock_call self.harness.add_relation_unit(relation_id, "mongos/1") _update_relation_data.assert_not_called()