mirror of
https://git.vectorsigma.ru/public/k3s.git
synced 2026-08-09 06:39:45 +00:00
[release-1.22] tests/vagrant (#4499)
From c77efe64e1:
- workflow: cgroup2 ➡️ cgroup
- tests/cgroup2/ ➡️ tests/vagrant/cgroup/unified/fedora-34/
Signed-off-by: Jacob Blain Christen <jacob@rancher.com>
This commit is contained in:
committed by
GitHub
parent
6c34ce8fef
commit
b13459b5cf
91
.github/workflows/cgroup.yaml
vendored
Normal file
91
.github/workflows/cgroup.yaml
vendored
Normal file
@@ -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
|
||||
76
.github/workflows/cgroup2.yaml
vendored
76
.github/workflows/cgroup2.yaml
vendored
@@ -1,76 +0,0 @@
|
||||
name: cgroup2
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- "**.md"
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- "**.md"
|
||||
workflow_dispatch: {}
|
||||
jobs:
|
||||
build:
|
||||
name: "Build"
|
||||
runs-on: ubuntu-20.04
|
||||
timeout-minutes: 40
|
||||
steps:
|
||||
- name: "Checkout"
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 1
|
||||
- name: "Make"
|
||||
run: DOCKER_BUILDKIT=1 SKIP_VALIDATE=1 make
|
||||
- name: "Upload k3s binary"
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: k3s
|
||||
path: dist/artifacts/k3s
|
||||
test:
|
||||
name: "Test"
|
||||
needs: build
|
||||
# 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: "Download k3s binary"
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: k3s
|
||||
path: ./tests/cgroup2
|
||||
- name: "Boot Fedora VM"
|
||||
run: |
|
||||
cp -r k3s.service k3s-rootless.service ./tests/util ./tests/cgroup2
|
||||
cd ./tests/cgroup2
|
||||
vagrant up
|
||||
vagrant ssh-config >> ~/.ssh/config
|
||||
- name: "Starting k3s"
|
||||
run: |
|
||||
ssh default -- sudo systemctl start k3s
|
||||
# Sonobuoy requires CoreDNS to be ready
|
||||
- name: "Waiting for CoreDNS to be ready"
|
||||
run: |
|
||||
ssh default -- sudo KUBECONFIG=/etc/rancher/k3s/k3s.yaml /vagrant/util/wait-for-coredns.sh
|
||||
# Vagrant is slow, so we set --mode=quick here
|
||||
- name: "Run Sonobuoy (--mode=quick)"
|
||||
run: |
|
||||
ssh default -- sudo KUBECONFIG=/etc/rancher/k3s/k3s.yaml sonobuoy run --mode=quick --wait
|
||||
- name: "Stopping k3s"
|
||||
run: |
|
||||
ssh default -- sudo systemctl stop k3s
|
||||
# FIXME: rootful k3s processes are still running even after `systemctl stop k3s`, so we reboot the VM here.
|
||||
# This reboot is also useful for ensuring `systemctl daemon-reload`: https://github.com/rootless-containers/rootlesscontaine.rs/issues/32
|
||||
cd ./tests/cgroup2
|
||||
vagrant halt
|
||||
vagrant up
|
||||
- name: "[Rootless] Starting k3s-rootless"
|
||||
run: |
|
||||
ssh default -- systemctl --user start k3s-rootless
|
||||
- name: "[Rootless] Waiting for CoreDNS to be ready"
|
||||
run: |
|
||||
ssh default -- KUBECONFIG=/home/vagrant/.kube/k3s.yaml /vagrant/util/wait-for-coredns.sh
|
||||
- name: "[Rootless] Run Sonobuoy (--mode=quick)"
|
||||
run: |
|
||||
ssh default -- KUBECONFIG=/home/vagrant/.kube/k3s.yaml sonobuoy run --mode=quick --wait
|
||||
14
.github/workflows/integration.yaml
vendored
14
.github/workflows/integration.yaml
vendored
@@ -1,11 +1,21 @@
|
||||
name: Integration Test Coverage
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
paths-ignore:
|
||||
- "**.md"
|
||||
- "channel.yaml"
|
||||
- "install.sh"
|
||||
- "tests/vagrant/**"
|
||||
- ".github/**"
|
||||
- "!.github/workflows/integration.yaml"
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- "**.md"
|
||||
- "channel.yaml"
|
||||
- "install.sh"
|
||||
- "tests/vagrant/**"
|
||||
- ".github/**"
|
||||
- "!.github/workflows/integration.yaml"
|
||||
workflow_dispatch: {}
|
||||
jobs:
|
||||
build:
|
||||
@@ -48,6 +58,8 @@ jobs:
|
||||
chmod +x ./dist/artifacts/k3s
|
||||
go test -coverpkg=./... -coverprofile=coverage.out ./pkg/... -run Integration
|
||||
go tool cover -func coverage.out
|
||||
# these tests do not relate to coverage and must be run separately
|
||||
go test ./tests/integration/... -run Integration
|
||||
- name: On Failure, Launch Debug Session
|
||||
if: ${{ failure() }}
|
||||
uses: mxschmitt/action-tmate@v3
|
||||
|
||||
14
.github/workflows/unitcoverage.yaml
vendored
14
.github/workflows/unitcoverage.yaml
vendored
@@ -1,11 +1,21 @@
|
||||
name: Unit Test Coverage
|
||||
on:
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
paths-ignore:
|
||||
- "**.md"
|
||||
- "channel.yaml"
|
||||
- "install.sh"
|
||||
- "tests/vagrant/**"
|
||||
- ".github/**"
|
||||
- "!.github/workflows/unitcoverage.yaml"
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- "**.md"
|
||||
- "channel.yaml"
|
||||
- "install.sh"
|
||||
- "tests/vagrant/**"
|
||||
- ".github/**"
|
||||
- "!.github/workflows/unitcoverage.yaml"
|
||||
workflow_dispatch: {}
|
||||
jobs:
|
||||
test:
|
||||
|
||||
Reference in New Issue
Block a user