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 ad8c14b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/nightly-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ jobs:
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: canonical/action-tmate@main
timeout-minutes: 120
7 changes: 4 additions & 3 deletions tests/integration/tests/test_util/etcd.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,21 +224,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
5 changes: 1 addition & 4 deletions tests/integration/tests/test_version_upgrades.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ad8c14b

Please sign in to comment.