forked from CiscoDevNet/terraform-provider-iosxe
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGNUmakefile
More file actions
129 lines (120 loc) · 5.12 KB
/
Copy pathGNUmakefile
File metadata and controls
129 lines (120 loc) · 5.12 KB
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
default: test
# Load environment variables from .env file if it exists
ifneq (,$(wildcard ./.env))
include .env
export
endif
# Run all acceptance tests across all devices and versions
.PHONY: test
test: test-1715-router test-1715-switch test-1712-router test-1712-switch
@echo ""
@echo "All multi-device tests completed!"
# Test against 17.15.x Router (C8000V)
# Usage: make test-1715-router [NAME=TestName] [DEBUG=1]
.PHONY: test-1715-router
test-1715-router:
@echo "========================================="
@echo "Testing against 17.15.x Router..."
@echo "========================================="
@if [ -z "$(IOSXE_1715_ROUTER_HOST)" ]; then \
echo "SKIPPED: IOSXE_1715_ROUTER_HOST is not configured"; \
echo "To enable this test, configure IOSXE_1715_ROUTER_HOST in your .env file"; \
else \
$(if $(DEBUG),echo "Debug mode enabled - logs will be written to test-output-1715-router.log";) \
$(if $(NAME),echo "Running tests matching: $(NAME)";) \
TF_ACC=1 \
IOSXE_HOST=$(IOSXE_1715_ROUTER_HOST) \
IOSXE_USERNAME=$(or $(IOSXE_1715_ROUTER_USERNAME),$(IOSXE_USERNAME)) \
IOSXE_PASSWORD=$(or $(IOSXE_1715_ROUTER_PASSWORD),$(IOSXE_PASSWORD)) \
IOSXE1715=1 \
C8000V=1 \
$(if $(DEBUG),TF_LOG=Trace) \
go test -v $(if $(NAME),-run $(NAME)) $(TESTARGS) -count 1 -timeout 60m ./... $(if $(DEBUG),2>&1 | tee test-output-1715-router.log); \
fi
# Test against 17.15.x Switch (C9000V)
# Usage: make test-1715-switch [NAME=TestName] [DEBUG=1]
.PHONY: test-1715-switch
test-1715-switch:
@echo "========================================="
@echo "Testing against 17.15.x Switch..."
@echo "========================================="
@if [ -z "$(IOSXE_1715_SWITCH_HOST)" ]; then \
echo "SKIPPED: IOSXE_1715_SWITCH_HOST is not configured"; \
echo "To enable this test, configure IOSXE_1715_SWITCH_HOST in your .env file"; \
else \
$(if $(DEBUG),echo "Debug mode enabled - logs will be written to test-output-1715-switch.log";) \
$(if $(NAME),echo "Running tests matching: $(NAME)";) \
TF_ACC=1 \
IOSXE_HOST=$(IOSXE_1715_SWITCH_HOST) \
IOSXE_USERNAME=$(or $(IOSXE_1715_SWITCH_USERNAME),$(IOSXE_USERNAME)) \
IOSXE_PASSWORD=$(or $(IOSXE_1715_SWITCH_PASSWORD),$(IOSXE_PASSWORD)) \
IOSXE1715=1 \
C9000V=1 \
$(if $(DEBUG),TF_LOG=Trace) \
go test -v $(if $(NAME),-run $(NAME)) $(TESTARGS) -count 1 -timeout 60m ./... $(if $(DEBUG),2>&1 | tee test-output-1715-switch.log); \
fi
# Test against 17.12.x Router (C8000V)
# Usage: make test-1712-router [NAME=TestName] [DEBUG=1]
.PHONY: test-1712-router
test-1712-router:
@echo "========================================="
@echo "Testing against 17.12.x Router..."
@echo "========================================="
@if [ -z "$(IOSXE_1712_ROUTER_HOST)" ]; then \
echo "SKIPPED: IOSXE_1712_ROUTER_HOST is not configured"; \
echo "To enable this test, configure IOSXE_1712_ROUTER_HOST in your .env file"; \
else \
$(if $(DEBUG),echo "Debug mode enabled - logs will be written to test-output-1712-router.log";) \
$(if $(NAME),echo "Running tests matching: $(NAME)";) \
TF_ACC=1 \
IOSXE_HOST=$(IOSXE_1712_ROUTER_HOST) \
IOSXE_USERNAME=$(or $(IOSXE_1712_ROUTER_USERNAME),$(IOSXE_USERNAME)) \
IOSXE_PASSWORD=$(or $(IOSXE_1712_ROUTER_PASSWORD),$(IOSXE_PASSWORD)) \
IOSXE1712=1 \
C8000V=1 \
$(if $(DEBUG),TF_LOG=Trace) \
go test -v $(if $(NAME),-run $(NAME)) $(TESTARGS) -count 1 -timeout 60m ./... $(if $(DEBUG),2>&1 | tee test-output-1712-router.log); \
fi
# Test against 17.12.x Switch (C9000V)
# Usage: make test-1712-switch [NAME=TestName] [DEBUG=1]
.PHONY: test-1712-switch
test-1712-switch:
@echo "========================================="
@echo "Testing against 17.12.x Switch..."
@echo "========================================="
@if [ -z "$(IOSXE_1712_SWITCH_HOST)" ]; then \
echo "SKIPPED: IOSXE_1712_SWITCH_HOST is not configured"; \
echo "To enable this test, configure IOSXE_1712_SWITCH_HOST in your .env file"; \
else \
$(if $(DEBUG),echo "Debug mode enabled - logs will be written to test-output-1712-switch.log";) \
$(if $(NAME),echo "Running tests matching: $(NAME)";) \
TF_ACC=1 \
IOSXE_HOST=$(IOSXE_1712_SWITCH_HOST) \
IOSXE_USERNAME=$(or $(IOSXE_1712_SWITCH_USERNAME),$(IOSXE_USERNAME)) \
IOSXE_PASSWORD=$(or $(IOSXE_1712_SWITCH_PASSWORD),$(IOSXE_PASSWORD)) \
IOSXE1712=1 \
C9000V=1 \
$(if $(DEBUG),TF_LOG=Trace) \
go test -v $(if $(NAME),-run $(NAME)) $(TESTARGS) -count 1 -timeout 60m ./... $(if $(DEBUG),2>&1 | tee test-output-1712-switch.log); \
fi
# Test all 17.15.x devices (router and switch)
.PHONY: test-1715
test-1715: test-1715-router test-1715-switch
@echo ""
@echo "All 17.15.x tests completed!"
# Test all 17.12.x devices (router and switch)
.PHONY: test-1712
test-1712: test-1712-router test-1712-switch
@echo ""
@echo "All 17.12.x tests completed!"
# Update a files from a single definition
# Usage: make gen NAME="Logging"
# NAME: The name of the definition, e.g. "Logging"
.PHONY: gen
gen:
go run gen/load_models.go
go run ./gen/generator.go "$(NAME)"
go run golang.org/x/tools/cmd/goimports -w internal/provider/
terraform fmt -recursive ./examples/
go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs
go run gen/doc_category.go