Skip to content

Commit

Permalink
Make etcd arch aware
Browse files Browse the repository at this point in the history
  • Loading branch information
addyess committed Sep 27, 2024
1 parent c33b61a commit 77127b4
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 14 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/nightly-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,11 @@ jobs:
release: ["latest/edge"]
fail-fast: false # TODO: remove once arm64 works

runs-on: ${{ matrix.arch == 'arm64' && 'Ubuntu_ARM64_4C_16G_01' || 'ubuntu-22.04' }}
runs-on: ${{ matrix.arch == 'arm64' && 'Ubuntu_ARM64_4C_16G_01' || 'ubuntu-20.04' }}

steps:
- name: Checking out repo
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
- name: Install lxd and tox
run: |
sudo apt update
Expand Down Expand Up @@ -64,3 +60,7 @@ jobs:
with:
name: ${{ env.artifact_name }}
path: ${{ github.workspace }}/inspection-reports.tar.gz
- name: Tmate debugging session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
timeout-minutes: 10
1 change: 1 addition & 0 deletions tests/integration/templates/etcd/etcd.service
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
LimitNOFILE=40000
TimeoutStartSec=0

Environment=ETCD_UNSUPPORTED_ARCH=$ARCH
ExecStart=/tmp/test-etcd/etcd --name $NAME \
--data-dir /tmp/etcd/s1 \
--listen-client-urls $CLIENT_URL \
Expand Down
8 changes: 5 additions & 3 deletions tests/integration/tests/test_util/etcd.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ def add_node(self):
]

substitutes = {
"ARCH": instance.arch,
"NAME": instance.id,
"IP": ip,
"CLIENT_URL": f"https://{ip}:2379",
Expand Down Expand Up @@ -224,21 +225,22 @@ def add_node(self):
input=str.encode(src.substitute(substitutes)),
)

arch = instance.arch
instance.exec(
[
"curl",
"-L",
f"{self.etcd_url}/{self.etcd_version}/etcd-{self.etcd_version}-linux-amd64.tar.gz",
f"{self.etcd_url}/{self.etcd_version}/etcd-{self.etcd_version}-linux-{arch}.tar.gz",
"-o",
f"/tmp/etcd-{self.etcd_version}-linux-amd64.tar.gz",
f"/tmp/etcd-{self.etcd_version}-linux-{arch}.tar.gz",
]
)
instance.exec(["mkdir", "-p", "/tmp/test-etcd"])
instance.exec(
[
"tar",
"xzvf",
f"/tmp/etcd-{self.etcd_version}-linux-amd64.tar.gz",
f"/tmp/etcd-{self.etcd_version}-linux-{arch}.tar.gz",
"-C",
"/tmp/test-etcd",
"--strip-components=1",
Expand Down
8 changes: 7 additions & 1 deletion tests/integration/tests/test_util/harness/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright 2024 Canonical, Ltd.
#
import subprocess
from functools import partial
from functools import cached_property, partial


class HarnessError(Exception):
Expand Down Expand Up @@ -30,6 +30,12 @@ def __init__(self, h: "Harness", id: str) -> None:
def id(self) -> str:
return self._id

@cached_property
def arch(self) -> str:
return self.exec(
["dpkg", "--print-architecture"], text=True, capture_output=True
).stdout.strip()

def __str__(self) -> str:
return f"{self._h.name}:{self.id}"

Expand Down
7 changes: 2 additions & 5 deletions tests/integration/tests/test_version_upgrades.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

@pytest.mark.node_count(1)
@pytest.mark.no_setup()
@pytest.mark.xfail("cilium failures are blocking this from working")
@pytest.mark.xfail(reason="cilium failures are blocking this from working")
@pytest.mark.skipif(
not config.VERSION_UPGRADE_CHANNELS, reason="No upgrade channels configured"
)
Expand All @@ -26,10 +26,7 @@ def test_version_upgrades(instances: List[harness.Instance]):
"'recent' requires the number of releases as second argument and the flavour as third argument"
)
_, num_channels, flavour = channels
arch = cp.exec(
["dpkg", "--print-architecture"], text=True, capture_output=True
).stdout.strip()
channels = snap.get_latest_channels(int(num_channels), flavour, arch)
channels = snap.get_latest_channels(int(num_channels), flavour, cp.arch)

LOG.info(
f"Bootstrap node on {channels[0]} and upgrade through channels: {channels[1:]}"
Expand Down

0 comments on commit 77127b4

Please sign in to comment.