Skip to content

Commit b38ed94

Browse files
Lock file maintenance Python dependencies (#465)
* Lock file maintenance Python dependencies * Backout ops and fix linting --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Dragomir Penev <[email protected]>
1 parent 155ccae commit b38ed94

File tree

6 files changed

+333
-334
lines changed

6 files changed

+333
-334
lines changed

poetry.lock

Lines changed: 300 additions & 300 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ repository = "https://github.com/canonical/postgresql-k8s-operator"
1414
[tool.poetry.dependencies]
1515
python = "^3.10"
1616
ops = "^2.12.0"
17-
cryptography = "^42.0.5"
18-
boto3 = "^1.34.95"
17+
cryptography = "^42.0.7"
18+
boto3 = "^1.34.118"
1919
pgconnstr = "^1.0.1"
20-
requests = "^2.31.0"
21-
tenacity = "^8.2.3"
20+
requests = "^2.32.3"
21+
tenacity = "^8.3.0"
2222
cosl = "^0.0.11"
2323
pydantic = "^1.10.15"
2424
poetry-core = "^1.9.0"
2525
jsonschema = "^4.22.0"
26-
jinja2 = "^3.1.3"
26+
jinja2 = "^3.1.4"
2727
lightkube = "^0.15.2"
2828
lightkube-models = "^1.28.1.4"
2929
psycopg2 = "^2.9.9"
@@ -43,21 +43,21 @@ cosl = "*"
4343
optional = true
4444

4545
[tool.poetry.group.format.dependencies]
46-
ruff = "^0.4.2"
46+
ruff = "^0.4.7"
4747

4848
[tool.poetry.group.lint]
4949
optional = true
5050

5151
[tool.poetry.group.lint.dependencies]
52-
codespell = "^2.2.6"
52+
codespell = "^2.3.0"
5353

5454
[tool.poetry.group.unit]
5555
optional = true
5656

5757
[tool.poetry.group.unit.dependencies]
58-
coverage = {extras = ["toml"], version = "^7.5.0"}
58+
coverage = {extras = ["toml"], version = "^7.5.3"}
5959
pydantic = "^1.10.15"
60-
pytest = "^8.2.0"
60+
pytest = "^8.2.2"
6161
pytest-mock = "^3.14.0"
6262
pytest-asyncio = "*"
6363
parameterized = "^0.9.0"
@@ -67,16 +67,16 @@ optional = true
6767

6868
[tool.poetry.group.integration.dependencies]
6969
lightkube = "^0.15.2"
70-
pytest = "^8.2.0"
70+
pytest = "^8.2.2"
7171
pytest-github-secrets = {git = "https://github.com/canonical/data-platform-workflows", tag = "v13.1.1", subdirectory = "python/pytest_plugins/github_secrets"}
7272
pytest-operator = "^0.35.0"
7373
pytest-operator-cache = {git = "https://github.com/canonical/data-platform-workflows", tag = "v13.1.1", subdirectory = "python/pytest_plugins/pytest_operator_cache"}
7474
pytest-operator-groups = {git = "https://github.com/canonical/data-platform-workflows", tag = "v13.1.1", subdirectory = "python/pytest_plugins/pytest_operator_groups"}
7575
# renovate caret doesn't work: https://github.com/renovatebot/renovate/issues/26940
76-
juju = "<=3.4.0.0"
76+
juju = "<=3.5.0.0"
7777
psycopg2-binary = "^2.9.9"
78-
boto3 = "^1.34.95"
79-
tenacity = "^8.2.3"
78+
boto3 = "^1.34.118"
79+
tenacity = "^8.3.0"
8080
allure-pytest = "^2.13.5"
8181

8282
[build-system]

tests/unit/test_charm.py

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def test_on_leader_elected(harness):
8484
Endpoints, name=f"patroni-{harness.charm.app.name}", namespace=harness.charm.model.name
8585
)
8686
_client.return_value.patch.assert_not_called()
87-
tc.assertIn("cluster_initialised", harness.get_relation_data(rel_id, harness.charm.app))
87+
assert "cluster_initialised" in harness.get_relation_data(rel_id, harness.charm.app)
8888

8989
# Trigger a new leader election and check that the password is still the same, and that the charm
9090
# fixes the missing "leader" key in the endpoint annotations.
@@ -397,8 +397,9 @@ def test_on_update_status_with_error_on_get_primary(harness):
397397

398398
with tc.assertLogs("charm", "ERROR") as logs:
399399
harness.charm.on.update_status.emit()
400-
tc.assertIn(
401-
"ERROR:charm:failed to get primary with error RetryError[fake error]", logs.output
400+
assert (
401+
"ERROR:charm:failed to get primary with error RetryError[fake error]"
402+
in logs.output
402403
)
403404

404405

@@ -694,7 +695,7 @@ def test_on_stop(harness):
694695
)
695696
_client.return_value.list.assert_not_called()
696697
_client.return_value.apply.assert_not_called()
697-
tc.assertIn("failed to get first pod info", "".join(logs.output))
698+
assert "failed to get first pod info" in "".join(logs.output)
698699

699700
# Test when the charm fails to get the k8s resources created by the charm and Patroni.
700701
_client.return_value.get.side_effect = None
@@ -708,9 +709,8 @@ def test_on_stop(harness):
708709
labels={"app.juju.is/created-by": harness.charm.app.name},
709710
)
710711
_client.return_value.apply.assert_not_called()
711-
tc.assertIn(
712-
"failed to get the k8s resources created by the charm and Patroni",
713-
"".join(logs.output),
712+
assert "failed to get the k8s resources created by the charm and Patroni" in "".join(
713+
logs.output
714714
)
715715

716716
# Test when the charm fails to patch a k8s resource.
@@ -724,8 +724,8 @@ def test_on_stop(harness):
724724
_client.return_value.apply.side_effect = [None, _FakeApiError]
725725
with tc.assertLogs("charm", "ERROR") as logs:
726726
harness.charm.on.stop.emit()
727-
tc.assertEqual(_client.return_value.apply.call_count, 2)
728-
tc.assertIn("failed to patch k8s MagicMock", "".join(logs.output))
727+
assert _client.return_value.apply.call_count == 2
728+
assert "failed to patch k8s MagicMock" in "".join(logs.output)
729729

730730

731731
def test_client_relations(harness):
@@ -1433,11 +1433,10 @@ def test_handle_postgresql_restart_need(harness):
14331433

14341434
harness.charm._handle_postgresql_restart_need()
14351435
_reload_patroni_configuration.assert_called_once()
1436-
(
1437-
tc.assertIn("tls", harness.get_relation_data(rel_id, harness.charm.unit))
1438-
if values[0]
1439-
else tc.assertNotIn("tls", harness.get_relation_data(rel_id, harness.charm.unit))
1440-
)
1436+
if values[0]:
1437+
assert "tls" in harness.get_relation_data(rel_id, harness.charm.unit)
1438+
else:
1439+
assert "tls" not in harness.get_relation_data(rel_id, harness.charm.unit)
14411440
if (values[0] != values[1]) or values[2]:
14421441
_generate_metrics_jobs.assert_called_once_with(values[0])
14431442
_restart.assert_called_once()
@@ -1501,4 +1500,4 @@ def test_set_active_status(harness):
15011500
_get_primary.side_effect = values[0]
15021501
_get_primary.return_value = None
15031502
harness.charm._set_active_status()
1504-
tc.assertIsInstance(harness.charm.unit.status, MaintenanceStatus)
1503+
assert isinstance(harness.charm.unit.status, MaintenanceStatus)

tests/unit/test_db.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ def test_on_relation_departed(harness):
402402
event.relation.data = {harness.charm.app: {}, harness.charm.unit: {}}
403403
event.departing_unit = harness.charm.unit
404404
harness.charm.legacy_db_relation._on_relation_departed(event)
405-
tc.assertIn("departing", harness.get_relation_data(peer_rel_id, harness.charm.unit))
405+
assert "departing" in harness.get_relation_data(peer_rel_id, harness.charm.unit)
406406

407407
# Test when this unit is departing the relation (due to the relation being broken between the apps).
408408
with harness.hooks_disabled():

tests/unit/test_patroni.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,10 +234,10 @@ def test_render_patroni_yml_file(harness, patroni):
234234

235235
# Also, ensure the right parameters are in the expected content
236236
# (as it was already validated with the above render file call).
237-
tc.assertIn("ssl: on", expected_content_with_tls)
238-
tc.assertIn("ssl_ca_file: /var/lib/postgresql/data/ca.pem", expected_content_with_tls)
239-
tc.assertIn("ssl_cert_file: /var/lib/postgresql/data/cert.pem", expected_content_with_tls)
240-
tc.assertIn("ssl_key_file: /var/lib/postgresql/data/key.pem", expected_content_with_tls)
237+
assert "ssl: on" in expected_content_with_tls
238+
assert "ssl_ca_file: /var/lib/postgresql/data/ca.pem" in expected_content_with_tls
239+
assert "ssl_cert_file: /var/lib/postgresql/data/cert.pem" in expected_content_with_tls
240+
assert "ssl_key_file: /var/lib/postgresql/data/key.pem" in expected_content_with_tls
241241

242242

243243
def test_primary_endpoint_ready(harness, patroni):

tests/unit/test_postgresql_provider.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def test_on_relation_departed(harness):
181181
event.relation.data = {harness.charm.app: {}, harness.charm.unit: {}}
182182
event.departing_unit = harness.charm.unit
183183
harness.charm.postgresql_client_relation._on_relation_departed(event)
184-
tc.assertIn("departing", harness.get_relation_data(peer_rel_id, harness.charm.unit))
184+
assert "departing" in harness.get_relation_data(peer_rel_id, harness.charm.unit)
185185

186186
# Test when this unit is departing the relation (due to the relation being broken between the apps).
187187
with harness.hooks_disabled():

0 commit comments

Comments
 (0)