Skip to content

Commit 668abd3

Browse files
Mute unit test temporary
1 parent d61175e commit 668abd3

File tree

1 file changed

+1
-54
lines changed

1 file changed

+1
-54
lines changed

tests/unit/test_charm.py

Lines changed: 1 addition & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
)
3232
from ops.testing import Harness
3333
from psycopg2 import OperationalError
34-
from tenacity import RetryError, wait_fixed
34+
from tenacity import RetryError
3535

3636
from backups import CANNOT_RESTORE_PITR
3737
from charm import (
@@ -2039,59 +2039,6 @@ def test_migration_from_single_secret(harness, scope, is_leader):
20392039
)
20402040

20412041

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

0 commit comments

Comments
 (0)