generated from hashicorp/terraform-provider-scaffolding
-
Notifications
You must be signed in to change notification settings - Fork 132
/
GNUmakefile
54 lines (44 loc) · 1.55 KB
/
GNUmakefile
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
TEST?=netbox/*.go
TEST_FUNC?=TestAccNetboxEventRule_basic
GOFMT_FILES?=$$(find . -name '*.go' | grep -v vendor)
DOCKER_COMPOSE=docker compose
export NETBOX_VERSION=v4.0.11
export NETBOX_SERVER_URL=https://localhost:8001
export NETBOX_API_TOKEN=0123456789abcdef0123456789abcdef01234567
export NETBOX_TOKEN=$(NETBOX_API_TOKEN)
default: testacc
# Run acceptance tests
.PHONY: testacc
testacc: docker-up
@echo "⌛ Startup acceptance tests on $(NETBOX_SERVER_URL) with version $(NETBOX_VERSION)"
TF_ACC=1 go test -timeout 20m -v -cover $(TEST)
.PHONY: testacc-specific-test
testacc-specific-test: # docker-up
@echo "⌛ Startup acceptance tests on $(NETBOX_SERVER_URL) with version $(NETBOX_VERSION)"
@echo "⌛ Testing function $(TEST_FUNC)"
TF_ACC=1 go test -timeout 20m -v -cover $(TEST) -run $(TEST_FUNC)
.PHONY: test
test:
go test $(TEST) $(TESTARGS) -timeout=120s -parallel=4 -cover
# 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) -f docker/docker-compose.yml up --build wait
$(DOCKER_COMPOSE) -f docker/docker-compose.yml logs
@echo "🚀 Netbox is up and running!"
.PHONY: docker-logs
docker-logs:
$(DOCKER_COMPOSE) -f docker/docker-compose.yml logs
.PHONY: docker-down
docker-down:
$(DOCKER_COMPOSE) -f docker/docker-compose.yml down --volumes
.PHONY: docs
docs:
NETBOX_API_TOKEN="" NETBOX_SERVER_URL="" go generate ./...
#! Development
# The following make goals are only for local usage
.PHONY: fmt
fmt:
go fmt
go fmt netbox/*.go