This folder contains the needed script for the github E2E tests.
prepare-platform.sh
: Script to setup the Ubuntu 20.04 VM and install all needed packages and tools. This script is used to set every VM of a github hosted runner and has to be executed manually when a self-hosted github runner is used.
prepare-platform-for-self-hosted-runner.sh
: In case of a self-hosted github runner this is used for the local setup. Self-hosted runners cannot use prepare-platform.sh
above because it does not allow sudo
operations.
setup-local-ingress.sh
: For local testing the /etc/hosts
file has to be changed to resolve keycloak.local
, alerta.local
, and ngsild.local
to the respective K8s ingresses.
bats/
: This directory contains the bats-detik and bats-core based tests.
The main difference between a self-hosted and a github hosted runner is the fact that the github-hosted runner provides a clean VM for every test and the self-hosted provides always access to the same VM. Therefore the self-hosted VM needs to be prepare initially and then only tasks related to the concrete tests can be executed. For security reason nothing can be executed with root
rights or sudo
.
Self-Hosted-Runners can be added to github as describe here. The VM which is added needs to fullfill the follwing:
-
The user under which the runner is installed must not be
root
and must not have password-lesssudo
rights. -
A
root
user must installprepare-platform.sh
with the env variableSELF_HOSTED_RUNNER
set, i.e.# SELF_HOSTED_RUNNER=true bash ./prepare-platform.sh
-
The environment variable
SELF_HOSTED_RUNNER
must be set in the github actions workflow. -
The tag
private
must be set for the self hosted runner, so that it is selected for the E2E test -
The user which owns the runner must be part of following groups:
docker
,runner
, e.g. by exeutingsudo usermod -a -G docker ${USER} sudo usermod -a -G runner ${USER}