From 09f259d790cd14b523f70eeed107c167e202911b Mon Sep 17 00:00:00 2001 From: James Falcon Date: Thu, 25 Apr 2024 20:41:05 -0500 Subject: [PATCH 1/3] test: Run Alpine tests without network None of the unit tests should be reaching out to the network. Since Alpine tests run under LXD, we can still easily run tests there without network. Also, include the tzdata package that was missed in 725f5fb and remove unneeded network debug lines. --- .github/workflows/alpine-unittests.yml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/alpine-unittests.yml b/.github/workflows/alpine-unittests.yml index b128875e3f5..3271e77d65b 100644 --- a/.github/workflows/alpine-unittests.yml +++ b/.github/workflows/alpine-unittests.yml @@ -38,15 +38,8 @@ jobs: # so switch groups to run lxd commands run: lxc launch images:alpine/edge alpine - - name: Check networking (for debugging) - run: | - lxc exec alpine -- ping -c 1 google.com || true - lxc exec alpine -- ping -c 1 dl-cdn.alpinelinux.org || true - lxc exec alpine -- nslookup www.google.com || true - lxc exec alpine -- ping -c 1 dl-cdn.alpinelinux.org || true - - name: Install dependencies - run: lxc exec alpine -- apk add py3-tox git + run: lxc exec alpine -- apk add py3-tox git tzdata - name: Mount source into container directory run: lxc config device add alpine gitdir disk source=$(pwd) path=/root/cloud-init-ro @@ -60,5 +53,9 @@ jobs: # https://github.com/canonical/cloud-init/issues/5158 run: lxc exec alpine -- ln -s /usr/share/zoneinfo/Europe/Brussels /etc/localtime + - name: Stop network + # Take down network interfaces to ensure tests don't use network + run: lxc exec alpine -- ifdown -a + - name: Run unittests run: lxc exec alpine --cwd /root/cloud-init-rw -- sh -c "tox -e py3" From f20c48ad71880ed729a981d1256801b2fcc7ec10 Mon Sep 17 00:00:00 2001 From: James Falcon Date: Thu, 25 Apr 2024 20:53:55 -0500 Subject: [PATCH 2/3] try stuff --- .github/workflows/alpine-unittests.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/alpine-unittests.yml b/.github/workflows/alpine-unittests.yml index 3271e77d65b..4a260cf38ce 100644 --- a/.github/workflows/alpine-unittests.yml +++ b/.github/workflows/alpine-unittests.yml @@ -38,6 +38,13 @@ jobs: # so switch groups to run lxd commands run: lxc launch images:alpine/edge alpine + - name: Check networking (for debugging) + run: | + lxc exec alpine -- ping -c 1 google.com || true + lxc exec alpine -- ping -c 1 dl-cdn.alpinelinux.org || true + lxc exec alpine -- nslookup www.google.com || true + lxc exec alpine -- ping -c 1 dl-cdn.alpinelinux.org || true + - name: Install dependencies run: lxc exec alpine -- apk add py3-tox git tzdata From 96ceefc7b15d75e0f2adb1b311980ba4db2979b4 Mon Sep 17 00:00:00 2001 From: James Falcon Date: Fri, 26 Apr 2024 19:39:05 -0500 Subject: [PATCH 3/3] try stuff --- .github/workflows/alpine-unittests.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/alpine-unittests.yml b/.github/workflows/alpine-unittests.yml index 4a260cf38ce..cb945550744 100644 --- a/.github/workflows/alpine-unittests.yml +++ b/.github/workflows/alpine-unittests.yml @@ -60,9 +60,13 @@ jobs: # https://github.com/canonical/cloud-init/issues/5158 run: lxc exec alpine -- ln -s /usr/share/zoneinfo/Europe/Brussels /etc/localtime + - name: Set up tox environment + # Setup the environment and then tell pytest to do essentially nothing + run: lxc exec alpine --cwd /root/cloud-init-rw -- tox -e py3 -- --cache-show= + - name: Stop network # Take down network interfaces to ensure tests don't use network run: lxc exec alpine -- ifdown -a - name: Run unittests - run: lxc exec alpine --cwd /root/cloud-init-rw -- sh -c "tox -e py3" + run: lxc exec alpine --cwd /root/cloud-init-rw -- tox -e py3