@@ -97,6 +97,7 @@ def test_on_leader_elected(self, _, __, _render_postgresql_conf_file, ___):
97
97
replication_password ,
98
98
)
99
99
100
+ @patch ("charm.Patroni.rock_postgresql_version" , new_callable = PropertyMock )
100
101
@patch ("charm.Patroni.primary_endpoint_ready" , new_callable = PropertyMock )
101
102
@patch ("charm.PostgresqlOperatorCharm.update_config" )
102
103
@patch ("charm.PostgresqlOperatorCharm.postgresql" )
@@ -120,7 +121,10 @@ def test_on_postgresql_pebble_ready(
120
121
_postgresql ,
121
122
___ ,
122
123
_primary_endpoint_ready ,
124
+ _rock_postgresql_version ,
123
125
):
126
+ _rock_postgresql_version .return_value = "14.7"
127
+
124
128
# Mock the primary endpoint ready property values.
125
129
_primary_endpoint_ready .side_effect = [False , True ]
126
130
@@ -157,10 +161,13 @@ def test_on_postgresql_pebble_ready(
157
161
self .assertEqual (container .get_service (self ._postgresql_service ).is_running (), True )
158
162
_push_tls_files_to_workload .assert_called_once ()
159
163
164
+ @patch ("charm.Patroni.rock_postgresql_version" , new_callable = PropertyMock )
160
165
@patch ("charm.PostgresqlOperatorCharm._create_pgdata" )
161
- def test_on_postgresql_pebble_ready_no_connection (self , _ ):
166
+ def test_on_postgresql_pebble_ready_no_connection (self , _ , _rock_postgresql_version ):
162
167
mock_event = MagicMock ()
163
168
mock_event .workload = self .harness .model .unit .get_container (self ._postgresql_container )
169
+ _rock_postgresql_version .return_value = "14.7"
170
+
164
171
self .charm ._on_postgresql_pebble_ready (mock_event )
165
172
166
173
# Event was deferred and status is still maintenance
0 commit comments