Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Run Alpine tests without network #5220

Merged
merged 3 commits into from
Apr 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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