Skip to content

Commit 5bbe6db

Browse files
Add s390x integration tests
1 parent a4d6965 commit 5bbe6db

File tree

4 files changed

+58
-7
lines changed

4 files changed

+58
-7
lines changed

.github/workflows/integration_test.yaml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ jobs:
4242
_, runner, task, variant = job.split(":")
4343
# Example: "test_charm.py"
4444
task = task.removeprefix("tests/spread/")
45-
if runner.endswith("-arm"):
45+
if "s390x" in runner:
46+
architecture = "s390x"
47+
elif runner.endswith("-arm"):
4648
architecture = "arm64"
4749
else:
4850
architecture = "amd64"
@@ -86,15 +88,20 @@ jobs:
8688
runs-on: ${{ matrix.job.runner }}
8789
timeout-minutes: 217 # Sum of steps `timeout-minutes` + 5
8890
steps:
89-
- name: Free up disk space
91+
- name: (GitHub hosted) Free up disk space
9092
timeout-minutes: 1
93+
if: ${{ !contains(matrix.job.runner, 'self-hosted') }}
9194
run: |
9295
printf '\nDisk usage before cleanup\n'
9396
df --human-readable
9497
# Based on https://github.com/actions/runner-images/issues/2840#issuecomment-790492173
9598
rm -r /opt/hostedtoolcache/
9699
printf '\nDisk usage after cleanup\n'
97100
df --human-readable
101+
- name: (IS hosted) Disk usage
102+
timeout-minutes: 1
103+
if: ${{ contains(matrix.job.runner, 'self-hosted') }}
104+
run: df --human-readable
98105
- name: Checkout
99106
timeout-minutes: 3
100107
uses: actions/checkout@v4

spread.yaml

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,18 @@ backends:
9393
username: runner
9494
variants:
9595
- -juju29
96+
- self-hosted-linux-s390x-noble-edge:
97+
username: ubuntu
98+
environment:
99+
# Several python packages (e.g. cryptography, bcrypt) do not have s390x builds on PyPI,
100+
# so they must be built from source. pkg-config & rust toolchain needed
101+
# (These packages are being built when installing poetry or integration test Python
102+
# dependencies)
103+
CONCIERGE_EXTRA_DEBS: pipx,pkg-config,rustup
104+
# s390x only available on edge
105+
CONCIERGE_MICROK8S_CHANNEL: 1.32-strict/edge
106+
variants:
107+
- -juju29
96108

97109
suites:
98110
tests/spread/:
@@ -109,10 +121,18 @@ prepare: |
109121
snap refresh --hold
110122
chown -R root:root "$SPREAD_PATH"
111123
cd "$SPREAD_PATH"
112-
snap install --classic concierge
124+
# Install via snap after https://github.com/canonical/concierge/pull/81 released
125+
go install github.com/canonical/concierge@latest
126+
127+
# Install charmcraft & pipx on lxd-vm backend and install pipx on IS-hosted runners
128+
~/go/bin/concierge prepare --trace
113129
114-
# Install charmcraft & pipx (on lxd-vm backend)
115-
concierge prepare --trace
130+
if [[ $SPREAD_SYSTEM == *"s390x"* ]]
131+
then
132+
rustup set profile minimal
133+
# TODO add renovate comment for rust version
134+
rustup default 1.88.0
135+
fi
116136
117137
pipx install tox poetry
118138
prepare-each: |
@@ -124,7 +144,7 @@ prepare-each: |
124144
poetry add --lock --group integration juju@^2
125145
fi
126146
# `concierge prepare` needs to be run for each spread job in case Juju version changed
127-
concierge prepare --trace
147+
~/go/bin/concierge prepare --trace
128148
129149
# Unable to set constraint on all models because of Juju bug:
130150
# https://bugs.launchpad.net/juju/+bug/2065050

tests/integration/markers.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@
1515
arm64_only = pytest.mark.skipif(
1616
architecture.architecture != "arm64", reason="Requires arm64 architecture"
1717
)
18+
s390x_only = pytest.mark.skipif(
19+
architecture.architecture != "s390x", reason="Requires s390x architecture"
20+
)

tests/integration/test_architecture.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,25 @@ async def test_amd_charm_on_arm_host(ops_test: OpsTest) -> None:
6161
)
6262

6363

64-
# TODO: add s390x test
64+
@markers.arm64_only
65+
async def test_amd_charm_on_s390x_host(ops_test: OpsTest) -> None:
66+
"""Tries deploying an amd64 charm on s390x host."""
67+
charm = "./[email protected]"
68+
69+
resources = {
70+
"mysql-router-image": METADATA["resources"]["mysql-router-image"]["upstream-source"]
71+
}
72+
73+
await ops_test.model.deploy(
74+
charm,
75+
application_name=MYSQL_ROUTER_APP_NAME,
76+
num_units=1,
77+
resources=resources,
78+
79+
)
80+
81+
await ops_test.model.wait_for_idle(
82+
apps=[MYSQL_ROUTER_APP_NAME],
83+
status="error",
84+
raise_on_error=False,
85+
)

0 commit comments

Comments
 (0)