from ops.testing import Harness
from pytest_mock import MockerFixture
-from charm import CharmError, OsmLcmCharm, check_service_active
+from charm import CharmError, OsmNGLcmCharm, check_service_active
-container_name = "lcm"
-service_name = "lcm"
+container_name = "nglcm"
+service_name = "nglcm"
@pytest.fixture
def harness(mocker: MockerFixture):
- harness = Harness(OsmLcmCharm)
+ harness = Harness(OsmNGLcmCharm)
harness.begin()
yield harness
harness.cleanup()
harness.charm.on.config_changed.emit()
assert type(harness.charm.unit.status) == BlockedStatus
assert all(
- relation in harness.charm.unit.status.message for relation in ["mongodb", "kafka", "ro"]
+ relation in harness.charm.unit.status.message for relation in ["mongodb", "temporal"]
)
relation_id = harness.add_relation("mongodb", "mongodb")
harness.add_relation_unit(relation_id, "mongodb/0")
harness.update_relation_data(
- relation_id, "mongodb/0", {"connection_string": "mongodb://:1234"}
+ relation_id,
+ "mongodb",
+ {"uris": "mongodb://:1234", "username": "user", "password": "password"},
)
relation_ids.append(relation_id)
- # Add kafka relation
- relation_id = harness.add_relation("kafka", "kafka")
- harness.add_relation_unit(relation_id, "kafka/0")
- harness.update_relation_data(relation_id, "kafka", {"host": "kafka", "port": 9092})
- relation_ids.append(relation_id)
- # Add ro relation
- relation_id = harness.add_relation("ro", "ro")
- harness.add_relation_unit(relation_id, "ro/0")
- harness.update_relation_data(relation_id, "ro", {"host": "ro", "port": 9090})
+ # Add temporal relation
+ relation_id = harness.add_relation("temporal", "temporal")
+ harness.add_relation_unit(relation_id, "temporal/0")
+ harness.update_relation_data(relation_id, "temporal", {"host": "temporal", "port": "7233"})
relation_ids.append(relation_id)
return relation_ids