File tree Expand file tree Collapse file tree 4 files changed +24
-16
lines changed Expand file tree Collapse file tree 4 files changed +24
-16
lines changed Original file line number Diff line number Diff line change 31
31
LINTER_RULES_PATH : /
32
32
VALIDATE_ALL_CODEBASE : false
33
33
VALIDATE_DOCKERFILE : false
34
+ VALIDATE_GITLEAKS : false
34
35
FILTER_REGEX_EXCLUDE : (.*/)?(LICENSE|configuration/.*)
35
36
EDITORCONFIG_FILE_NAME : .ecrc
36
37
DOCKERFILE_HADOLINT_FILE_NAME : .hadolint.yaml
Original file line number Diff line number Diff line change @@ -3,12 +3,13 @@ services:
3
3
netbox :
4
4
image : ${IMAGE-netboxcommunity/netbox:latest}
5
5
depends_on :
6
- - postgres
7
- - redis
8
- - redis-cache
6
+ postgres :
7
+ condition : service_healthy
8
+ redis :
9
+ condition : service_started
10
+ redis-cache :
11
+ condition : service_started
9
12
env_file : env/netbox.env
10
- environment :
11
- SKIP_STARTUP_SCRIPTS : ${SKIP_STARTUP_SCRIPTS-false}
12
13
user : ' unit:root'
13
14
volumes :
14
15
- ./configuration:/etc/netbox/config:z,ro
@@ -19,6 +20,11 @@ services:
19
20
postgres :
20
21
image : postgres:15-alpine
21
22
env_file : env/postgres.env
23
+ healthcheck :
24
+ test : ["CMD-SHELL", "pg_isready"]
25
+ interval : 10s
26
+ timeout : 5s
27
+ retries : 5
22
28
redis :
23
29
image : redis:7-alpine
24
30
command :
Original file line number Diff line number Diff line change 80
80
echo " π‘ Superuser Username: ${SUPERUSER_NAME} , E-Mail: ${SUPERUSER_EMAIL} "
81
81
fi
82
82
83
- # Print warning if startup scripts (and initializers) would've been run # Remove for next release
84
- if [ " $SKIP_STARTUP_SCRIPTS " == " true" ]; then
85
- # Nothing to do
86
- echo " " # Empty block not allowed
87
- else
88
- echo " β οΈβ οΈβ οΈ WARNING: The initializers have been moved to a plugin. See release notes."
89
- echo " β οΈβ οΈβ οΈ Set environment variable 'SKIP_STARTUP_SCRIPTS' to 'true' to remove this warning."
90
- fi
91
-
92
83
echo " β
Initialisation is done."
93
84
94
85
# Launch whatever is passed by docker
Original file line number Diff line number Diff line change @@ -35,20 +35,29 @@ if [ -z "${IMAGE}" ]; then
35
35
fi
36
36
37
37
# The docker compose command to use
38
- doco=" docker- compose --file docker-compose.test.yml --project-name netbox_docker_test_ ${1} "
38
+ doco=" docker compose --file docker-compose.test.yml --project-name netbox_docker_test "
39
39
40
40
test_setup () {
41
41
echo " π Setup up test environment"
42
+ $doco up --detach --quiet-pull --wait --force-recreate --renew-anon-volumes --no-start
43
+ $doco start postgres
44
+ $doco start redis
45
+ $doco start redis-cache
42
46
}
43
47
44
48
test_netbox_unit_tests () {
45
49
echo " β± Running NetBox Unit Tests"
46
50
$doco run --rm netbox /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py test
47
51
}
48
52
53
+ test_compose_db_setup () {
54
+ echo " β± Running NetBox DB migrations"
55
+ $doco run --rm netbox /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py migrate
56
+ }
57
+
49
58
test_cleanup () {
50
59
echo " π£ Cleaning Up"
51
- $doco down -v
60
+ $doco down --volumes
52
61
}
53
62
54
63
echo " π³π³π³ Start testing '${IMAGE} '"
@@ -58,5 +67,6 @@ trap test_cleanup EXIT ERR
58
67
test_setup
59
68
60
69
test_netbox_unit_tests
70
+ test_compose_db_setup
61
71
62
72
echo " π³π³π³ Done testing '${IMAGE} '"
You canβt perform that action at this time.
0 commit comments