1
+ dockerImage? =marklogic-centos/marklogic-server-centos:10-internal
1
2
2
- install-go-modules :
3
+ # # System requirement:
4
+ # # - Go
5
+ # # - Helm
6
+ # # - Minikube
7
+ # # - GNU Make >= 3.8.2 (preferrably >=4.2.1)
8
+
9
+ # ***************************************************************************
10
+ # help
11
+ # ***************************************************************************
12
+ # # Get this help text
13
+ .PHONY : help
14
+ help :
15
+ @printf " Usage\n" ;
16
+
17
+ @awk '{ \
18
+ if ($$0 ~ /^.PHONY: [a-zA-Z\-\_0-9]+$$/) { \
19
+ helpCommand = substr($$0, index($$0, ":") + 2); \
20
+ if (helpMessage) { \
21
+ printf "\033[36m%-20s\033[0m %s\n", \
22
+ helpCommand, helpMessage; \
23
+ helpMessage = ""; \
24
+ } \
25
+ } else if ($$0 ~ /^[a-zA-Z\-\_0-9.]+:/) { \
26
+ helpCommand = substr($$0, 0, index($$0, ":")); \
27
+ if (helpMessage) { \
28
+ printf "\033[36m%-20s\033[0m %s\n", \
29
+ helpCommand, helpMessage; \
30
+ helpMessage = ""; \
31
+ } \
32
+ } else if ($$0 ~ /^# #/) { \
33
+ if (helpMessage) { \
34
+ helpMessage = helpMessage"\n "substr($$0, 3); \
35
+ } else { \
36
+ helpMessage = substr($$0, 3); \
37
+ } \
38
+ } else { \
39
+ if (helpMessage) { \
40
+ print "\n "helpMessage"\n" \
41
+ } \
42
+ helpMessage = ""; \
43
+ } \
44
+ }' \
45
+ $(MAKEFILE_LIST)
46
+
47
+ # # ---------- Development Tasks ----------
48
+
49
+ # ***************************************************************************
50
+ # prepare
51
+ # ***************************************************************************
52
+ # # Install dependencies
53
+ .PHONY : prepare
54
+ prepare :
3
55
go mod tidy
4
56
5
- test/e2e : install-go-modules
6
- sh ./test/e2e/e2e.sh
57
+ # ***************************************************************************
58
+ # lint
59
+ # ***************************************************************************
60
+ # # Lint the code
61
+ # # Options:
62
+ # # * [Jenkins] optional. If we are running in Jenkins enviroment. Example: Jenkins=true
63
+ .PHONY : lint
64
+ lint :
65
+ @echo " > Linting helm charts....."
66
+ helm lint --with-subcharts charts/ $(if $(Jenkins ) , > helm-lint-output.txt,)
67
+
68
+ @echo "> Linting tests....."
69
+ docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.49.0 golangci-lint run $(if $(Jenkins), > test-lint-output.txt,)
70
+
71
+ # # ---------- Testing Tasks ----------
72
+
73
+ # ***************************************************************************
74
+ # e2e-test
75
+ # ***************************************************************************
76
+ # # Run all end to end tests
77
+ # # Options:
78
+ # # * [dockerImage] optional. default is marklogicdb/marklogic-db:latest. Example: dockerImage=marklogic-centos/marklogic-server-centos:10-internal
79
+ .PHONY : e2e-test
80
+ e2e-test : prepare
81
+ @echo " =====Installing minikube cluster"
82
+ minikube start --driver=docker -n=1
83
+
84
+ @echo "=====Loading marklogc image $(dockerImage) to minikube cluster"
85
+ minikube image load $(dockerImage)
86
+
87
+ @echo "=====Running tests"
88
+ go test -v -count=1 ./test/e2e/...
89
+
90
+ @echo "=====Delete minikube cluster"
91
+ minikube delete
7
92
8
- test/template : install-go-modules
93
+ # ***************************************************************************
94
+ # template-test
95
+ # ***************************************************************************
96
+ # # Run all template tests
97
+ .PHONY : template-test
98
+ template-test : prepare
9
99
go test -v ./test/template/...
10
100
11
- test : test/template test/e2e
101
+ # ***************************************************************************
102
+ # test
103
+ # ***************************************************************************
104
+ # # Run all tests
105
+ # # Options:
106
+ # # * [dockerImage] optional. default is marklogicdb/marklogic-db:latest. Example: dockerImage=marklogic-centos/marklogic-server-centos:10-internal
107
+ .PHONY : test
108
+ test : template-test e2e-test
0 commit comments