-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGNUmakefile
92 lines (78 loc) · 2.41 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
default: fmt lint install generate
build:
go build -v ./...
install: build
go install -v ./...
lint:
golangci-lint run
generate:
cd tools; go generate ./...
generate-client:
cd client; go generate ./...
fmt:
gofmt -s -w -e .
update:
go get -u ./...
test:
go test -v -cover -timeout=120s -parallel=10 ./... -skip TestIntegration TestAcc
testacc:
@if [ ! -f .env ]; then \
echo "Error: .env file not found. Copy .env.example to .env and configure it."; \
exit 1; \
fi
@echo "Running acceptance tests..."
source .env && \
TF_ACC=1 \
CTRLPLANE_TOKEN="$${CTRLPLANE_PROVIDER_TESTING_API_KEY}" \
CTRLPLANE_WORKSPACE="$${CTRLPLANE_PROVIDER_TESTING_WORKSPACE}" \
CTRLPLANE_BASE_URL="$${CTRLPLANE_PROVIDER_TESTING_BASE_URL}" \
go test \
-timeout=$${GO_TEST_TIMEOUT:-120m} \
-parallel=$${GO_TEST_PARALLEL:-4} \
-cover \
$${TEST:-./internal/provider/...} $${TESTARGS}
testacc-quiet:
@if [ ! -f .env ]; then \
echo "Error: .env file not found. Copy .env.example to .env and configure it."; \
exit 1; \
fi
@echo "Running acceptance tests with reduced verbosity..."
source .env && \
TF_ACC=1 \
TF_LOG=ERROR \
CTRLPLANE_TOKEN="$${CTRLPLANE_PROVIDER_TESTING_API_KEY}" \
CTRLPLANE_WORKSPACE="$${CTRLPLANE_PROVIDER_TESTING_WORKSPACE}" \
CTRLPLANE_BASE_URL="$${CTRLPLANE_PROVIDER_TESTING_BASE_URL}" \
go test \
-timeout=$${GO_TEST_TIMEOUT:-120m} \
-parallel=$${GO_TEST_PARALLEL:-4} \
-cover \
-v=0 \
$${TEST:-./internal/provider/...} $${TESTARGS}
testint:
@if [ ! -f .env ]; then \
echo "Error: .env file not found. Copy .env.example to .env and configure it."; \
exit 1; \
fi
@echo "Running integration tests..."
source .env && \
INTEGRATION_TEST_MODE="$${INTEGRATION_TEST_MODE:-autocleanup}" \
CTRLPLANE_TOKEN="$${CTRLPLANE_PROVIDER_TESTING_API_KEY}" \
CTRLPLANE_WORKSPACE="$${CTRLPLANE_PROVIDER_TESTING_WORKSPACE}" \
CTRLPLANE_BASE_URL="$${CTRLPLANE_PROVIDER_TESTING_BASE_URL}" \
go run github.com/onsi/ginkgo/v2/ginkgo run -v ./internal/integration
testexamples: build
for dir in examples/resources/*; do \
cd $$dir && \
terraform init && \
terraform plan -out=plan.tfplan && \
terraform apply plan.tfplan -auto-approve; \
terraform destroy -auto-approve; \
done
# Clean test artifacts
clean:
rm -f terraform.log
rm -rf .terraform
rm -f .terraform.lock.hcl
rm -f terraform.tfstate*
.PHONY: fmt lint test testacc testint testexamples build install generate clean install-local