From 78ff54c8aec134f1c118a123256edf97d035b8cc Mon Sep 17 00:00:00 2001 From: James Page Date: Mon, 1 May 2023 17:39:53 +0200 Subject: [PATCH] Fixup unit test container connection --- tests/unit/test_charm.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/unit/test_charm.py b/tests/unit/test_charm.py index dda3e31..8982911 100644 --- a/tests/unit/test_charm.py +++ b/tests/unit/test_charm.py @@ -61,6 +61,9 @@ def test_action(self): def test_rabbitmq_pebble_ready(self): """Test pebble handler.""" + # Get the rabbitmq container from the model + container = self.harness.model.unit.get_container("rabbitmq") + self.harness.set_can_connect(container, True) # self.harness.charm._render_and_push_config_files = Mock() # self.harness.charm._render_and_push_plugins = Mock() # Check the initial Pebble plan is empty @@ -88,8 +91,6 @@ def test_rabbitmq_pebble_ready(self): }, }, } - # Get the rabbitmq container from the model - container = self.harness.model.unit.get_container("rabbitmq") # RabbitMQ is up, operator user initialized peers_relation_id = self.harness.add_relation("peers", "rabbitmq-k8s") self.harness.add_relation_unit(peers_relation_id, "rabbitmq-k8s/0")