Skip to content

Commit

Permalink
tests/vagrant: refactor vagrant smoke tests (#4484)
Browse files Browse the repository at this point in the history
- updated `tests/TESTING.md`
- cgroup, snapshotter, and install tests all under tests/vagrant
- cgroup and snapshotter workflows trigger for all code changes on all branches (excluding markdown docs, install script, and other vagrant tests)
- install workflow triggers for relevant script and fixture changes, only on master or pull-requests that target it
- integration and unit test workflows should not trigger for install script changes nor anything under tests/vagrant

Signed-off-by: Jacob Blain Christen <[email protected]>
  • Loading branch information
dweomer authored Nov 15, 2021
1 parent f18b325 commit c77efe6
Show file tree
Hide file tree
Showing 18 changed files with 597 additions and 429 deletions.
91 changes: 91 additions & 0 deletions .github/workflows/cgroup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Control Group
on:
push:
paths-ignore:
- "**.md"
- "channel.yaml"
- "install.sh"
- "tests/**"
- "!tests/vagrant/cgroup/**"
- ".github/**"
- "!.github/workflows/cgroup.yaml"
pull_request:
paths-ignore:
- "**.md"
- "channel.yaml"
- "install.sh"
- "tests/**"
- "!tests/vagrant/cgroup/**"
- ".github/**"
- "!.github/workflows/cgroup.yaml"
workflow_dispatch: {}
jobs:
prep:
name: "Prepare"
runs-on: ubuntu-20.04
timeout-minutes: 40
steps:
- name: "Checkout"
uses: actions/checkout@v2
with: { fetch-depth: 1 }
- name: "Build"
run: DOCKER_BUILDKIT=1 SKIP_VALIDATE=1 make
- name: "Upload"
uses: actions/upload-artifact@v2
with: { name: k3s, path: dist/artifacts/k3s }
test:
name: "Smoke Test"
needs: prep
# nested virtualization is only available on macOS hosts
runs-on: macos-10.15
timeout-minutes: 40
strategy:
fail-fast: false
matrix:
vm: [fedora-34]
mode: [unified]
max-parallel: 1
defaults:
run:
working-directory: tests/vagrant/cgroup/${{ matrix.mode }}/${{ matrix.vm }}
steps:
- name: "Checkout"
uses: actions/checkout@v2
with: { fetch-depth: 1 }
- name: "Download Binary"
uses: actions/download-artifact@v2
with: { name: k3s, path: dist/artifacts/ }
- name: "Vagrant Cache"
uses: actions/cache@v2
with:
path: |
~/.vagrant.d/boxes
~/.vagrant.d/gems
key: cgroup-${{ hashFiles(format('tests/vagrant/cgroup/{0}/{1}/Vagrantfile', matrix.mode, matrix.vm)) }}
id: vagrant-cache
continue-on-error: true
- name: "Vagrant Plugin(s)"
run: vagrant plugin install vagrant-k3s
- name: "Vagrant Up ⏩ Install K3s"
run: vagrant up
- name: "K3s Start" # start k3s rootfull
run: vagrant ssh -- sudo systemctl start k3s-server
- name: "K3s Ready" # wait for k3s to be ready
run: vagrant provision --provision-with=k3s-ready
- name: "K3s Status" # kubectl get node,all -A -o wide
run: vagrant provision --provision-with=k3s-status
- name: "Sonobuoy (--mode=quick)"
env: {TEST_RESULTS_PATH: rootfull}
run: vagrant provision --provision-with=k3s-sonobuoy
- name: "K3s Stop" # stop k3s rootfull
run: vagrant ssh -- sudo systemctl stop k3s-server
- name: "Vagrant Reload"
run: vagrant reload
- name: "[Rootless] Starting K3s"
run: vagrant ssh -- systemctl --user start k3s-rootless
- name: "[Rootless] K3s Ready"
env: {TEST_KUBECONFIG: /home/vagrant/.kube/k3s.yaml}
run: vagrant provision --provision-with=k3s-ready
- name: "[Rootless] Sonobuoy (--mode=quick)"
env: {TEST_KUBECONFIG: /home/vagrant/.kube/k3s.yaml, TEST_RESULTS_PATH: rootless}
run: vagrant provision --provision-with=k3s-sonobuoy
80 changes: 0 additions & 80 deletions .github/workflows/cgroup2.yaml

This file was deleted.

150 changes: 55 additions & 95 deletions .github/workflows/install.yaml
Original file line number Diff line number Diff line change
@@ -1,111 +1,71 @@
name: Installer
name: Install Script
on:
push:
branches: [main, master]
paths:
- "channel.yaml"
- "install.sh"
- "tests/install/**"
- "tests/vagrant/install/**"
pull_request:
branches: [main, master]
paths:
- "install.sh"
- "tests/install/**"
- "tests/vagrant/install/**"
workflow_dispatch: {}
jobs:
install-centos-7:
name: "CentOS 7"
# nested virtualization is only available on macOS hosts
test:
name: "Smoke Test"
runs-on: macos-10.15
timeout-minutes: 40
strategy:
fail-fast: false
matrix:
channel: [stable]
vm: [centos-7, centos-8, fedora-coreos, opensuse-leap, opensuse-microos, ubuntu-focal]
include:
- {channel: latest, vm: centos-8}
- {channel: latest, vm: ubuntu-focal}
- {channel: latest, vm: opensuse-leap}
- {channel: testing, vm: centos-8}
- {channel: testing, vm: opensuse-leap}
- {channel: testing, vm: ubuntu-focal}
max-parallel: 2
defaults:
run:
working-directory: tests/vagrant/install/${{ matrix.vm }}
env:
INSTALL_K3S_CHANNEL: ${{ matrix.channel }}
steps:
- name: "Checkout"
uses: actions/checkout@v2
with: {fetch-depth: 1}
- name: "Vagrant Cache"
uses: actions/cache@v2
with:
fetch-depth: 1
- name: "VagrantPlugin::K3S"
working-directory: tests/install/centos-7
run: vagrant plugin install vagrant-k3s
- name: "Vagrant::⬆"
working-directory: tests/install/centos-7
run: vagrant up
install-centos-8:
name: "CentOS 8"
# nested virtualization is only available on macOS hosts
runs-on: macos-10.15
timeout-minutes: 40
steps:
- name: "Checkout"
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: "VagrantPlugin::K3S"
working-directory: tests/install/centos-8
run: vagrant plugin install vagrant-k3s
- name: "Vagrant::⬆"
working-directory: tests/install/centos-8
run: vagrant up
install-fedora-coreos:
name: "Fedora CoreOS"
# nested virtualization is only available on macOS hosts
runs-on: macos-10.15
timeout-minutes: 40
steps:
- name: "Checkout"
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: "VagrantPlugin::K3S"
working-directory: tests/install/fedora-coreos
run: vagrant plugin install vagrant-k3s
- name: "Vagrant::⬆"
working-directory: tests/install/fedora-coreos
run: vagrant up
install-opensuse-leap:
name: "openSUSE Leap"
# nested virtualization is only available on macOS hosts
runs-on: macos-10.15
timeout-minutes: 40
steps:
- name: "Checkout"
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: "VagrantPlugin::K3S"
working-directory: tests/install/opensuse-leap
run: vagrant plugin install vagrant-k3s
- name: "Vagrant::⬆"
working-directory: tests/install/opensuse-leap
run: vagrant up
install-opensuse-microos:
name: "openSUSE MicroOS"
# nested virtualization is only available on macOS hosts
runs-on: macos-10.15
timeout-minutes: 40
steps:
- name: "Checkout"
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: "VagrantPlugin::Reload"
working-directory: tests/install/opensuse-microos
run: vagrant plugin install vagrant-reload
- name: "VagrantPlugin::K3S"
working-directory: tests/install/opensuse-microos
run: vagrant plugin install vagrant-k3s
- name: "Vagrant::⬆"
working-directory: tests/install/opensuse-microos
run: vagrant up
install-ubuntu-focal:
name: "Ubuntu Focal"
# nested virtualization is only available on macOS hosts
runs-on: macos-10.15
timeout-minutes: 40
steps:
- name: "Checkout"
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: "VagrantPlugin::K3S"
working-directory: tests/install/ubuntu-focal
run: vagrant plugin install vagrant-k3s
- name: "Vagrant::⬆"
working-directory: tests/install/ubuntu-focal
path: |
~/.vagrant.d/boxes
~/.vagrant.d/gems
key: install-${{ hashFiles(format('tests/vagrant/install/{0}/Vagrantfile', matrix.vm)) }}
id: vagrant-cache
continue-on-error: true
- name: "Vagrant Plugin(s)"
run: vagrant plugin install vagrant-k3s vagrant-reload
- name: "Vagrant Up ⏩ Install K3s"
run: vagrant up
- name: "⏳ Node"
run: vagrant provision --provision-with=k3s-wait-for-node
- name: "⏳ CoreDNS"
run: vagrant provision --provision-with=k3s-wait-for-coredns
- name: "⏳ Local Storage"
run: vagrant provision --provision-with=k3s-wait-for-local-storage
continue-on-error: true
- name: "⏳ Metrics Server"
run: vagrant provision --provision-with=k3s-wait-for-metrics-server
continue-on-error: true
- name: "⏳ Traefik"
run: vagrant provision --provision-with=k3s-wait-for-traefik
continue-on-error: true
- name: "k3s-status"
run: vagrant provision --provision-with=k3s-status
- name: "k3s-procps"
run: vagrant provision --provision-with=k3s-procps
10 changes: 8 additions & 2 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@ on:
push:
paths-ignore:
- "**.md"
- "channel.yaml"
- "install.sh"
- "tests/install"
- "tests/vagrant/**"
- ".github/**"
- "!.github/workflows/integration.yaml"
pull_request:
paths-ignore:
- "**.md"
- "channel.yaml"
- "install.sh"
- "tests/install"
- "tests/vagrant/**"
- ".github/**"
- "!.github/workflows/integration.yaml"
workflow_dispatch: {}
jobs:
build:
Expand Down
Loading

0 comments on commit c77efe6

Please sign in to comment.