generated from hashicorp/terraform-provider-scaffolding-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start netbox in docker for acceptance tests
- Loading branch information
Showing
4 changed files
with
73 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,18 @@ | ||
DOCKER_COMPOSE=docker compose | ||
|
||
export NETBOX_SERVER_URL=http://localhost:8001 | ||
export NETBOX_API_TOKEN=0123456789abcdef0123456789abcdef01234567 | ||
|
||
default: testacc | ||
|
||
# Run acceptance tests | ||
.PHONY: testacc | ||
testacc: | ||
testacc: docker-up | ||
TF_ACC=1 go test ./... -v $(TESTARGS) -timeout 120m | ||
|
||
# Run dockerized Netbox for acceptance testing | ||
.PHONY: docker-up | ||
docker-up: | ||
@echo "⌛ Startup Netbox $(NETBOX_VERSION) and wait for service to become ready" | ||
$(DOCKER_COMPOSE) up -d netbox --wait | ||
@echo "🚀 Netbox is up and running!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--- | ||
version: "3.7" | ||
services: | ||
postgres: | ||
image: postgres:14-alpine | ||
environment: | ||
- POSTGRES_USER=netbox | ||
- POSTGRES_PASSWORD=netbox | ||
- POSTGRES_DB=netbox | ||
redis: | ||
image: redis:6-alpine | ||
netbox: | ||
build: | ||
context: tools/integration | ||
args: | ||
NETBOX_VERSION: ${NETBOX_VERSION:-3.7.8} | ||
NETBOX_BGP_VERSION: ${NETBOX_BGP_VERSION:-0.12.1} | ||
depends_on: | ||
- postgres | ||
- redis | ||
ports: | ||
- 8001:8080 | ||
environment: | ||
- CORS_ORIGIN_ALLOW_ALL=True | ||
- DB_NAME=netbox | ||
- DB_USER=netbox | ||
- DB_PASSWORD=netbox | ||
- DB_HOST=postgres | ||
- REDIS_HOST=redis | ||
- REDIS_DATABASE=0 | ||
- REDIS_SSL=false | ||
- REDIS_CACHE_HOST=redis | ||
- REDIS_CACHE_DATABASE=1 | ||
- REDIS_CACHE_SSL=false | ||
- SECRET_KEY=0123456789abcdefghij0123456789abcdefghij0123456789 | ||
- SKIP_STARTUP_SCRIPTS=false | ||
- SKIP_SUPERUSER=false | ||
- SUPERUSER_NAME=admin | ||
- SUPERUSER_EMAIL=admin@example.com | ||
- SUPERUSER_PASSWORD=admin | ||
- SUPERUSER_API_TOKEN=${NETBOX_API_TOKEN:-0123456789abcdef0123456789abcdef01234567} | ||
healthcheck: | ||
test: ["CMD", "curl", "-f", "http://localhost:8080/api/status/"] | ||
interval: 10s | ||
timeout: 10s | ||
retries: 10 | ||
start_period: 5s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
ARG NETBOX_VERSION | ||
FROM netboxcommunity/netbox:v${NETBOX_VERSION} | ||
|
||
ARG NETBOX_BGP_VERSION | ||
RUN /opt/netbox/venv/bin/pip install --no-warn-script-location netbox-bgp==${NETBOX_BGP_VERSION} | ||
|
||
COPY plugins.py /etc/netbox/config/plugins.py | ||
RUN SECRET_KEY="dummydummydummydummydummydummydummydummydummydummy" /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
PLUGINS = ["netbox_bgp"] | ||
|
||
PLUGINS_CONFIG = { | ||
'netbox_bgp': {}, | ||
} |