netbox-acls/test.sh
Ryan Merolle f0b461616b
netbox 3.6 support (#167)
netbox 3.6 support thanks to @abhi1693 & @kbelokon
2024-03-27 00:09:32 -04:00

30 lines
711 B
Bash
Executable File

#!/bin/bash
# Runs the NetBox plugin unit tests
# exit when a command exits with an exit code != 0
set -e
# The docker compose command to use
doco="docker compose --file docker-compose.yml"
test_netbox_unit_tests() {
echo "⏱ Running NetBox Unit Tests"
$doco run --rm netbox python manage.py makemigrations netbox_acls --check
$doco run --rm netbox python manage.py test netbox_acls -v 2
}
test_cleanup() {
echo "💣 Cleaning Up"
$doco down -v
$doco rm -fsv
docker image rm docker.io/library/netbox-acls-netbox || echo ''
}
echo "🐳🐳🐳 Start testing"
# Make sure the cleanup script is executed
trap test_cleanup EXIT ERR
test_netbox_unit_tests
echo "🐳🐳🐳 Done testing"