Skip to content

Commit

Permalink
test: Run Alpine tests without network (#5220)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
TheRealFalcon committed Apr 30, 2024
1 parent e41b719 commit 44ad8ac
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/alpine-unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
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
Expand All @@ -60,5 +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

0 comments on commit 44ad8ac

Please sign in to comment.