Skip to content

Commit 40752dd

Browse files
committed
test(config): assert update_config threads enable_tls into render
update_config always renders patroni.yml with enable_tls=is_tls_enabled, but the orchestration tests mocked render_patroni_yml_file without checking that kwarg, so a regression hardcoding or inverting the TLS flag would still pass. Pin that the flag reaches the render call for both the enabled and disabled states. Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
1 parent bd93fb7 commit 40752dd

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

tests/unit/test_config_manager.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,18 @@ def test_update_config_no_peers_returns_true_early(orchestrate, postgresql_clien
792792
orchestrate.handle_restart_need.assert_not_called()
793793

794794

795+
def test_update_config_threads_tls_flag_into_render(orchestrate, postgresql_client):
796+
"""is_tls_enabled is what update_config passes as render_patroni_yml_file's enable_tls."""
797+
orchestrate._is_tls.return_value = True
798+
orchestrate.update_config(postgresql_client, user_hash="uh", no_peers=True)
799+
assert orchestrate.render_patroni_yml_file.call_args.kwargs["enable_tls"] is True
800+
801+
orchestrate.render_patroni_yml_file.reset_mock()
802+
orchestrate._is_tls.return_value = False
803+
orchestrate.update_config(postgresql_client, user_hash="uh", no_peers=True)
804+
assert orchestrate.render_patroni_yml_file.call_args.kwargs["enable_tls"] is False
805+
806+
795807
def test_update_config_workload_not_running_persists_tls_and_refreshes(
796808
orchestrate, postgresql_client
797809
):

0 commit comments

Comments
 (0)