Add smoke/basic functional test

Without this patch, we don't test on release whether kured actually
works and behave well.

This is a problem, as a functional issue could have been hidden by
a recent change, as our testing is minimalist (only test the
usability, not the functionality).
Instead of testing manually, we should ensure this in CI.

This fixes it by adding a github action which tests the previously
built artifacts before publishing a release. The job consume the helm
chart in our code tree  (note: this relies on the last released image),
and run a functional test triggering a coordinated restart of a
whole 5 node cluster deployed with kind, through github actions.

Note: The github action needs to reset docker configuration, else
the reboot of the node (a docker container in kind) will fail.
It will be correctly triggered, but the node will not come back up,
with its systemd log mentioning: "Failed to attach 1 to compat systemd cgroup".
This commit is contained in:
Jean-Philippe Evrard
2020-08-28 09:25:44 +02:00
parent b024898ed6
commit 3d75f1b37a
4 changed files with 162 additions and 0 deletions
+66
View File
@@ -0,0 +1,66 @@
# This needs all the previous artifacts to be created:
# the image should be published, the repo should be tagged, the helm
# chart pushed. It's assumed everything is working, and we are doing
# a last final test at the release creation time to _ensure_ we can
# release. At this point it's still time to back off in case of problem,
# not publish the release and iterate on tags.
name: Smoke test
on:
push:
branches:
- '**'
release:
types: created
jobs:
deploy-manifests:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: "0"
- name: Workaround "Failed to attach 1 to compat systemd cgroup /actions_job/..." on gh actions
run: |
sudo bash << EOF
cp /etc/docker/daemon.json /etc/docker/daemon.json.old
echo '{}' > /etc/docker/daemon.json
systemctl restart docker || journalctl --no-pager -n 500
systemctl status docker
EOF
- name: Create 5 node kind cluster
uses: helm/kind-action@master
with:
config: .github/kind-cluster.yaml
- name: Deploy kured on default namespace with its helm chart
run: |
curl -o helm3.tgz https://get.helm.sh/helm-v3.3.0-linux-amd64.tar.gz
tar xf helm3.tgz
./linux-amd64/helm install kured ./charts/kured/ --set configuration.period=1m
kubectl config set-context kind-chart-testing
kubectl get ds --all-namespaces
kubectl describe ds kured
- name: Ensure kured is ready
uses: nick-invision/retry@v1
with:
timeout_minutes: 10
max_attempts: 10
retry_wait_seconds: 60
# DESIRED CURRENT READY UP-TO-DATE AVAILABLE should all be = 5
command: "kubectl get ds kured | grep -E 'kured.*5.*5.*5.*5.*5' "
- name: Create reboot sentinel files
run: |
./tests/kind/create-reboot-sentinels.sh
- name: Follow reboot until success
env:
DEBUG: true
run: |
./tests/kind/follow-coordinated-reboot.sh