Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DPE-6523] Remove AMD64-only test markers #605

Merged
merged 4 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 15 additions & 21 deletions tests/integration/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,29 +317,23 @@ async def app_name(ops_test: OpsTest) -> str:
return None


def cluster_name(unit: Unit, model_name: str) -> str:
"""Returns the MySQL cluster name.
async def get_model_logs(ops_test: OpsTest, log_level: str, log_lines: int = 100) -> str:
"""Return the juju logs from a specific model.

Args:
unit: A unit to get data from
model_name: The current model name
Returns:
The (str) mysql cluster name
"""
output = subprocess.check_output([
"juju",
"show-unit",
unit.name,
"--format=json",
f"--model={model_name}",
])
output = json.loads(output.decode("utf-8"))

for relation in output[unit.name]["relation-info"]:
if relation["endpoint"] == "database-peers":
return relation["application-data"]["cluster-name"]
logger.error(f"Failed to retrieve cluster name from unit {unit.name}")
raise ValueError("Failed to retrieve cluster name")
ops_test: The ops test object passed into every test case
log_level: The logging level to return messages from
log_lines: The maximum lines to return at once
"""
_, output, _ = await ops_test.juju(
"debug-log",
f"--model={ops_test.model.info.name}",
f"--level={log_level}",
f"--lines={log_lines}",
"--no-tail",
carlcsaposs-canonical marked this conversation as resolved.
Show resolved Hide resolved
)

return output


async def get_process_pid(ops_test: OpsTest, unit_name: str, process: str) -> int:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import pytest
from pytest_operator.plugin import OpsTest

from .. import juju_, markers
from .. import juju_
from ..helpers import get_leader_unit, get_primary_unit_wrapper, retrieve_database_variable_value
from .high_availability_helpers import (
ensure_all_units_continuous_writes_incrementing,
Expand All @@ -23,7 +23,6 @@


@pytest.mark.group(1)
@markers.amd64_only # TODO: remove after arm64 stable release
@pytest.mark.abort_on_fail
async def test_deploy_stable(ops_test: OpsTest) -> None:
"""Simple test to ensure that the mysql and application charms get deployed."""
Expand Down Expand Up @@ -55,7 +54,6 @@ async def test_deploy_stable(ops_test: OpsTest) -> None:


@pytest.mark.group(1)
@markers.amd64_only # TODO: remove after arm64 stable release
@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 @@ -80,7 +78,6 @@ async def test_pre_upgrade_check(ops_test: OpsTest) -> None:


@pytest.mark.group(1)
@markers.amd64_only # TODO: remove after arm64 stable release
async def test_upgrade_from_stable(ops_test: OpsTest):
"""Test updating from stable channel."""
application = ops_test.model.applications[MYSQL_APP_NAME]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@
from pytest_operator.plugin import OpsTest

from .. import juju_, markers
from ..helpers import get_leader_unit, get_relation_data, get_unit_by_index
from ..helpers import (
get_leader_unit,
get_model_logs,
get_relation_data,
get_unit_by_index,
)
from .high_availability_helpers import (
ensure_all_units_continuous_writes_incrementing,
relate_mysql_and_application,
Expand Down Expand Up @@ -173,6 +178,11 @@ async def test_rollback(ops_test, continuous_writes) -> None:
)
await ops_test.model.wait_for_idle(apps=[MYSQL_APP_NAME], status="active", timeout=TIMEOUT)

logger.info("Ensure rollback has taken place")
message = "Downgrade is incompatible. Resetting workload"
warnings = await get_model_logs(ops_test, log_level="WARNING")
assert message in warnings

logger.info("Ensure continuous_writes after rollback procedure")
await ensure_all_units_continuous_writes_incrementing(ops_test)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import pytest
from pytest_operator.plugin import OpsTest

from .. import markers
from .high_availability_helpers import (
ensure_all_units_continuous_writes_incrementing,
relate_mysql_and_application,
Expand All @@ -24,7 +23,6 @@


@pytest.mark.group(1)
@markers.amd64_only # TODO: remove after arm64 stable release
@pytest.mark.abort_on_fail
async def test_deploy_stable(ops_test: OpsTest) -> None:
"""Simple test to ensure that the mysql and application charms get deployed."""
Expand Down Expand Up @@ -57,7 +55,6 @@ async def test_deploy_stable(ops_test: OpsTest) -> None:


@pytest.mark.group(1)
@markers.amd64_only # TODO: remove after arm64 stable release
async def test_refresh_without_pre_upgrade_check(ops_test: OpsTest):
"""Test updating from stable channel."""
application = ops_test.model.applications[MYSQL_APP_NAME]
Expand Down Expand Up @@ -90,7 +87,6 @@ async def test_refresh_without_pre_upgrade_check(ops_test: OpsTest):


@pytest.mark.group(1)
@markers.amd64_only # TODO: remove after arm64 stable release
async def test_rollback_without_pre_upgrade_check(ops_test: OpsTest):
"""Test refresh back to stable channel."""
application = ops_test.model.applications[MYSQL_APP_NAME]
Expand Down
Loading