forked from netbox-community/netbox-acls
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·38 lines (29 loc) · 957 Bytes
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
# Runs the NetBox plugin unit tests
# Usage:
# ./test.sh latest
# ./test.sh v2.9.7
# ./test.sh develop-2.10
# exit when a command exits with an exit code != 0
set -e
# NETBOX_VARIANT is used by `Dockerfile` to determine the tag
NETBOX_VARIANT="${1-latest}"
# 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
}
test_cleanup() {
echo "💣 Cleaning Up"
$doco down -v
$doco rm -fsv
docker image rm docker.io/library/netbox-acls-netbox || echo ''
}
export NETBOX_VARIANT=${NETBOX_VARIANT}
echo "🐳🐳🐳 Start testing '${NETBOX_VARIANT}'"
# Make sure the cleanup script is executed
trap test_cleanup EXIT ERR
test_netbox_unit_tests
echo "🐳🐳🐳 Done testing '${NETBOX_VARIANT}'"