@@ -1164,11 +1164,28 @@ def test_update_config(
11641164 with patch .object (PostgresqlOperatorCharm , "postgresql" , Mock ()) as postgresql_mock :
11651165 # Mock some properties.
11661166 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 ]
11681168 _member_started .side_effect = [True , True , False ]
11691169 postgresql_mock .build_postgresql_parameters .return_value = {"test" : "test" }
11701170
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+
11711187 # Test without TLS files available.
1188+ self .harness .update_config (unset = {"profile-limit-memory" , "profile_limit_memory" })
11721189 self .harness .update_relation_data (
11731190 self .rel_id , self .charm .unit .name , {"tls" : "enabled" }
11741191 ) # Mock some data in the relation to test that it change.
0 commit comments