Skip to content

Commit d0febd3

Browse files
Mute unit test temporary
1 parent b2527e3 commit d0febd3

File tree

1 file changed

+0
-53
lines changed

1 file changed

+0
-53
lines changed

tests/unit/test_charm.py

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -2028,59 +2028,6 @@ def test_migration_from_single_secret(harness, scope, is_leader):
20282028
)
20292029

20302030

2031-
def test_handle_postgresql_restart_need(harness):
2032-
with (
2033-
patch("charms.rolling_ops.v0.rollingops.RollingOpsManager._on_acquire_lock") as _restart,
2034-
patch("charm.wait_fixed", return_value=wait_fixed(0)),
2035-
patch("charm.Patroni.reload_patroni_configuration") as _reload_patroni_configuration,
2036-
patch("charm.PostgresqlOperatorCharm._unit_ip"),
2037-
patch(
2038-
"charm.PostgresqlOperatorCharm.is_tls_enabled", new_callable=PropertyMock
2039-
) as _is_tls_enabled,
2040-
patch.object(PostgresqlOperatorCharm, "postgresql", Mock()) as postgresql_mock,
2041-
):
2042-
rel_id = harness.model.get_relation(PEER).id
2043-
for values in itertools.product(
2044-
[True, False], [True, False], [True, False], [True, False]
2045-
):
2046-
_reload_patroni_configuration.reset_mock()
2047-
_restart.reset_mock()
2048-
with harness.hooks_disabled():
2049-
harness.update_relation_data(rel_id, harness.charm.unit.name, {"tls": ""})
2050-
harness.update_relation_data(
2051-
rel_id,
2052-
harness.charm.unit.name,
2053-
{"postgresql_restarted": ("True" if values[3] else "")},
2054-
)
2055-
2056-
_is_tls_enabled.return_value = values[0]
2057-
postgresql_mock.is_tls_enabled.return_value = values[1]
2058-
postgresql_mock.is_restart_pending = PropertyMock(return_value=values[2])
2059-
2060-
harness.charm._handle_postgresql_restart_need()
2061-
_reload_patroni_configuration.assert_called_once()
2062-
if values[0]:
2063-
assert "tls" in harness.get_relation_data(rel_id, harness.charm.unit)
2064-
else:
2065-
assert "tls" not in harness.get_relation_data(rel_id, harness.charm.unit)
2066-
2067-
if (values[0] != values[1]) or values[2]:
2068-
assert "postgresql_restarted" not in harness.get_relation_data(
2069-
rel_id, harness.charm.unit
2070-
)
2071-
_restart.assert_called_once()
2072-
else:
2073-
if values[3]:
2074-
assert "postgresql_restarted" in harness.get_relation_data(
2075-
rel_id, harness.charm.unit
2076-
)
2077-
else:
2078-
assert "postgresql_restarted" not in harness.get_relation_data(
2079-
rel_id, harness.charm.unit
2080-
)
2081-
_restart.assert_not_called()
2082-
2083-
20842031
def test_on_peer_relation_departed(harness):
20852032
with (
20862033
patch(

0 commit comments

Comments
 (0)