-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile
49 lines (33 loc) · 1.18 KB
/
Makefile
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
SHELL := /bin/bash
AZURE_HARNESS := ./tests/azure_test_harness
DOCKER_HARNESS := ./tests/docker_test_harness
tidy:
go mod tidy
build: tidy
go build -v .
test: tidy
go test -v ./internal/...
install: tidy
go install
accTest:
if [ -f local.env ]; then source ./local.env; fi && TF_ACC=1 go test -count 1 -timeout 60m -v ./internal/...
setupAccTest:
cd $(MAKE_PATH); terraform init -reconfigure && terraform apply -auto-approve
destroyAccTest:
cd $(MAKE_PATH) && terraform destroy -auto-approve
accTestLifecycle:
$(MAKE) accTest; TEST_CODE=$$?; $(MAKE) $(MAKE_DESTROY_TARGET) && exit $$TEST_CODE
# AZURE
azureSetupAccTest:
MAKE_PATH=$(AZURE_HARNESS) $(MAKE) setupAccTest
azureDestroyAccTest:
cd $(AZURE_HARNESS) && terraform init -reconfigure && (terraform state rm azurerm_mssql_elasticpool.this; terraform destroy -auto-approve)
azureAccTest: azureSetupAccTest
MAKE_DESTROY_TARGET=azureDestroyAccTest $(MAKE) accTestLifecycle
#DOCKER
dockerSetupAccTest:
MAKE_PATH=$(DOCKER_HARNESS) $(MAKE) setupAccTest
dockerDestroyAccTest:
MAKE_PATH=$(DOCKER_HARNESS) $(MAKE) destroyAccTest
dockerAccTest: dockerSetupAccTest
MAKE_DESTROY_TARGET=dockerDestroyAccTest $(MAKE) accTestLifecycle