Skip to content

Commit

Permalink
use new charm + small adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasgameiroborges committed Dec 4, 2024
1 parent 88dd50b commit 0835d07
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 15 deletions.
2 changes: 1 addition & 1 deletion lib/charms/postgresql_k8s/v0/postgresql.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

# Increment this PATCH version before using `charmcraft publish-lib` or reset
# to 0 if you are raising the major API version
LIBPATCH = 39
LIBPATCH = 40

INVALID_EXTRA_USER_ROLE_BLOCKING_MESSAGE = "invalid role(s) for extra user roles"

Expand Down
2 changes: 1 addition & 1 deletion src/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
SNAP_PACKAGES = [
(
POSTGRESQL_SNAP_NAME,
{"revision": {"aarch64": "137", "x86_64": "136"}},
{"revision": {"aarch64": "138", "x86_64": "139"}},
)
]

Expand Down
2 changes: 1 addition & 1 deletion src/dependency.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
"dependencies": {},
"name": "charmed-postgresql",
"upgrade_supported": "^16",
"version": "16.4"
"version": "16.6"
}
}
2 changes: 1 addition & 1 deletion src/upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def _on_upgrade_charm_check_legacy(self) -> None:
"dependencies": {},
"name": "charmed-postgresql",
"upgrade_supported": "^16",
"version": "16.4",
"version": "16.6",
}
self.peer_relation.data[self.charm.app].update({
"dependencies": json.dumps(fixed_dependencies)
Expand Down
4 changes: 0 additions & 4 deletions tests/integration/ha_tests/test_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@


@pytest.mark.group(1)
@pytest.mark.unstable
@pytest.mark.abort_on_fail
async def test_deploy_latest(ops_test: OpsTest) -> None:
"""Simple test to ensure that the PostgreSQL and application charms get deployed."""
Expand All @@ -54,7 +53,6 @@ async def test_deploy_latest(ops_test: OpsTest) -> None:


@pytest.mark.group(1)
@pytest.mark.unstable
@pytest.mark.abort_on_fail
async def test_pre_upgrade_check(ops_test: OpsTest) -> None:
"""Test that the pre-upgrade-check action runs successfully."""
Expand All @@ -68,7 +66,6 @@ async def test_pre_upgrade_check(ops_test: OpsTest) -> None:


@pytest.mark.group(1)
@pytest.mark.unstable
@pytest.mark.abort_on_fail
async def test_upgrade_from_edge(ops_test: OpsTest, continuous_writes) -> None:
# Start an application that continuously writes data to the database.
Expand Down Expand Up @@ -119,7 +116,6 @@ async def test_upgrade_from_edge(ops_test: OpsTest, continuous_writes) -> None:


@pytest.mark.group(1)
@pytest.mark.unstable
@pytest.mark.abort_on_fail
async def test_fail_and_rollback(ops_test, continuous_writes) -> None:
# Start an application that continuously writes data to the database.
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_backups.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def test_can_use_s3_repository(harness):
patch("charm.Patroni.member_started", new_callable=PropertyMock) as _member_started,
patch("charm.PostgresqlOperatorCharm.update_config") as _update_config,
patch(
"charm.Patroni.get_postgresql_version", return_value="16.4"
"charm.Patroni.get_postgresql_version", return_value="16.6"
) as _get_postgresql_version,
patch("charm.PostgresqlOperatorCharm.postgresql") as _postgresql,
patch(
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ def test_on_start(harness):
side_effect=[False, True, True, True, True, True],
) as _is_storage_attached,
):
_get_postgresql_version.return_value = "16.4"
_get_postgresql_version.return_value = "16.6"

# Test without storage.
harness.charm.on.start.emit()
Expand Down Expand Up @@ -709,7 +709,7 @@ def test_on_start_replica(harness):
return_value=True,
) as _is_storage_attached,
):
_get_postgresql_version.return_value = "16.4"
_get_postgresql_version.return_value = "16.6"

# Set the current unit to be a replica (non leader unit).
harness.set_leader(False)
Expand Down Expand Up @@ -768,7 +768,7 @@ def test_on_start_no_patroni_member(harness):
bootstrap_cluster = patroni.return_value.bootstrap_cluster
bootstrap_cluster.return_value = True

patroni.return_value.get_postgresql_version.return_value = "16.4"
patroni.return_value.get_postgresql_version.return_value = "16.6"

harness.set_leader()
harness.charm.on.start.emit()
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/test_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,11 @@ def test_get_postgresql_version(peers_ips, patroni):
_get_installed_snaps = _snap_client.return_value.get_installed_snaps
_get_installed_snaps.return_value = [
{"name": "something"},
{"name": "charmed-postgresql", "version": "16.4"},
{"name": "charmed-postgresql", "version": "16.6"},
]
version = patroni.get_postgresql_version()

assert version == "16.4"
assert version == "16.6"
_snap_client.assert_called_once_with()
_get_installed_snaps.assert_called_once_with()

Expand Down Expand Up @@ -314,7 +314,7 @@ def test_render_patroni_yml_file(peers_ips, patroni):
patch("charm.Patroni.render_file") as _render_file,
patch("charm.Patroni._create_directory"),
):
_get_postgresql_version.return_value = "16.4"
_get_postgresql_version.return_value = "16.6"

# Define variables to render in the template.
member_name = "postgresql-0"
Expand Down

0 comments on commit 0835d07

Please sign in to comment.