Skip to content

Commit 2bb989c

Browse files
authored
[DPE-7309][DPE-7326] Re-enable upgrade tests (#934)
* Reenable tests * Update libs * Linting
1 parent 04b21d5 commit 2bb989c

File tree

8 files changed

+18
-69
lines changed

8 files changed

+18
-69
lines changed

lib/charms/operator_libs_linux/v2/snap.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102

103103
# Increment this PATCH version before using `charmcraft publish-lib` or reset
104104
# to 0 if you are raising the major API version
105-
LIBPATCH = 10
105+
LIBPATCH = 11
106106

107107

108108
# Regex to locate 7-bit C1 ANSI sequences
@@ -577,6 +577,9 @@ def _refresh(
577577
if revision:
578578
args.append(f'--revision="{revision}"')
579579

580+
if self.confinement == 'classic':
581+
args.append('--classic')
582+
580583
if devmode:
581584
args.append("--devmode")
582585

poetry.lock

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

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ package-mode = false
66
requires-poetry = ">=2.0.0"
77

88
[tool.poetry.dependencies]
9-
python = "^3.10"
9+
python = "^3.12"
1010
ops = "^2.22.0"
1111
boto3 = "^1.38.28"
1212
pgconnstr = "^1.0.1"
@@ -105,7 +105,7 @@ target-version = ["py38"]
105105
[tool.ruff]
106106
# preview and explicit preview are enabled for CPY001
107107
preview = true
108-
target-version = "py310"
108+
target-version = "py312"
109109
src = ["src", "."]
110110
line-length = 99
111111

src/backups.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import shutil
1212
import tempfile
1313
import time
14-
from datetime import datetime, timezone
14+
from datetime import UTC, datetime
1515
from io import BytesIO
1616
from pathlib import Path
1717
from subprocess import TimeoutExpired, run
@@ -421,9 +421,7 @@ def _generate_backup_list_output(self) -> str:
421421
backup_reference, _ = self._parse_backup_id(backup["reference"][-1])
422422
lsn_start_stop = f"{backup['lsn']['start']} / {backup['lsn']['stop']}"
423423
time_start, time_stop = (
424-
datetime.strftime(
425-
datetime.fromtimestamp(stamp, timezone.utc), "%Y-%m-%dT%H:%M:%SZ"
426-
)
424+
datetime.strftime(datetime.fromtimestamp(stamp, UTC), "%Y-%m-%dT%H:%M:%SZ")
427425
for stamp in backup["timestamp"].values()
428426
)
429427
backup_timeline = (
@@ -526,7 +524,7 @@ def _list_timelines(self) -> dict[str, tuple[str, str]]:
526524

527525
return dict[str, tuple[str, str]]({
528526
datetime.strftime(
529-
datetime.fromtimestamp(timeline_object["time"], timezone.utc),
527+
datetime.fromtimestamp(timeline_object["time"], UTC),
530528
BACKUP_ID_FORMAT,
531529
): (
532530
timeline.split("/")[1],
@@ -574,8 +572,8 @@ def _parse_psql_timestamp(self, timestamp: str) -> datetime:
574572
t = re.sub(r"\.(\d+)", lambda x: f".{x[1]:06}", t)
575573
dt = datetime.fromisoformat(t)
576574
# Convert to the timezone-naive
577-
if dt.tzinfo is not None and dt.tzinfo is not timezone.utc:
578-
dt = dt.astimezone(tz=timezone.utc)
575+
if dt.tzinfo is not None and dt.tzinfo is not UTC:
576+
dt = dt.astimezone(tz=UTC)
579577
return dt.replace(tzinfo=None)
580578

581579
def _parse_backup_id(self, label) -> tuple[str, str]:

tests/integration/ha_tests/test_self_healing_3.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from pytest_operator.plugin import OpsTest
88
from tenacity import Retrying, stop_after_delay, wait_fixed
99

10-
from .. import markers
1110
from ..helpers import (
1211
CHARM_BASE,
1312
db_connect,
@@ -161,7 +160,6 @@ async def test_forceful_restart_without_data_and_transaction_logs(
161160

162161

163162
@pytest.mark.abort_on_fail
164-
@markers.amd64_only
165163
async def test_network_cut(ops_test: OpsTest, continuous_writes, primary_start_timeout):
166164
"""Completely cut and restore network."""
167165
# Locate primary unit.
@@ -250,7 +248,6 @@ async def test_network_cut(ops_test: OpsTest, continuous_writes, primary_start_t
250248

251249

252250
@pytest.mark.abort_on_fail
253-
@markers.amd64_only
254251
async def test_network_cut_without_ip_change(
255252
ops_test: OpsTest, continuous_writes, primary_start_timeout
256253
):

tests/integration/ha_tests/test_smoke.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# Copyright 2021 Canonical Ltd.
33
# See LICENSE file for licensing details.
44

5-
import asyncio
65
import logging
76

87
import pytest
@@ -174,7 +173,7 @@ async def test_app_resources_conflicts_v3(ops_test: OpsTest, charm: str):
174173
await ops_test.model.wait_for_idle(
175174
apps=[DUP_DATABASE_APP_NAME], timeout=60, idle_period=30, status="waiting"
176175
)
177-
except asyncio.TimeoutError:
176+
except TimeoutError:
178177
logger.info("Application is not in waiting state. Checking logs...")
179178

180179
for attempt in Retrying(stop=stop_after_delay(60 * 10), wait=wait_fixed(3), reraise=True):

tests/spread/test_upgrade.py/task.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,3 @@ execute: |
55
tox run -e integration -- "tests/integration/$TEST_MODULE" --model testing --alluredir="$SPREAD_TASK/allure-results"
66
artifacts:
77
- allure-results
8-
systems:
9-
- -ubuntu-24.04
10-
- -ubuntu-24.04-arm

tests/spread/test_upgrade_from_stable.py/task.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,3 @@ execute: |
55
tox run -e integration -- "tests/integration/$TEST_MODULE" --model testing --alluredir="$SPREAD_TASK/allure-results"
66
artifacts:
77
- allure-results
8-
systems:
9-
- -ubuntu-24.04
10-
- -ubuntu-24.04-arm

0 commit comments

Comments
 (0)