@@ -1164,11 +1164,28 @@ def test_update_config(
1164
1164
with patch .object (PostgresqlOperatorCharm , "postgresql" , Mock ()) as postgresql_mock :
1165
1165
# Mock some properties.
1166
1166
postgresql_mock .is_tls_enabled = PropertyMock (side_effect = [False , False , False , False ])
1167
- _is_workload_running .side_effect = [True , True , False , True ]
1167
+ _is_workload_running .side_effect = [False , False , True , True , False , True ]
1168
1168
_member_started .side_effect = [True , True , False ]
1169
1169
postgresql_mock .build_postgresql_parameters .return_value = {"test" : "test" }
1170
1170
1171
+ # Test when only one of the two config options for profile limit memory is set.
1172
+ self .harness .update_config ({"profile-limit-memory" : 1000 })
1173
+ self .charm .update_config ()
1174
+
1175
+ # Test when only one of the two config options for profile limit memory is set.
1176
+ self .harness .update_config (
1177
+ {"profile_limit_memory" : 1000 }, unset = {"profile-limit-memory" }
1178
+ )
1179
+ self .charm .update_config ()
1180
+
1181
+ # Test when the two config options for profile limit memory are set at the same time.
1182
+ _render_patroni_yml_file .reset_mock ()
1183
+ self .harness .update_config ({"profile-limit-memory" : 1000 })
1184
+ with self .assertRaises (ValueError ):
1185
+ self .charm .update_config ()
1186
+
1171
1187
# Test without TLS files available.
1188
+ self .harness .update_config (unset = {"profile-limit-memory" , "profile_limit_memory" })
1172
1189
self .harness .update_relation_data (
1173
1190
self .rel_id , self .charm .unit .name , {"tls" : "enabled" }
1174
1191
) # Mock some data in the relation to test that it change.
0 commit comments