To run MicroK8s tests locally, you must install specific system dependencies (python3, pytest, pip3, docker.io, tox) and Python packages (requests, pyyaml, sh). The testing process involves running static analysis with tox, building/installing the snap locally, and then executing the test suite using pytest.
# Install dependencies (Ubuntu example)
sudo apt install python3-pip docker.io tox -y
pip3 install -U pytest requests pyyaml sh
# Run static analysis
tox -e lint
# Run test suites
pytest -s tests/test-simple.py
pytest -s tests/test-upgrade.py
Note on Ingress Tests: If ingress or dashboard-ingress tests fail due to DNS rebinding protection with nip.io, add the following to your /etc/hosts:
127.0.0.1 kubernetes-dashboard.127.0.0.1.nip.io
127.0.0.1 microbot.127.0.0.1.nip.io