@@ -31,6 +31,13 @@ BUILD_INFO=-ldflags "${BUILD_X1} ${BUILD_X2}"
31
31
BUILD_INFO_TESTS =-ldflags "-X $(BUILD_INFO_IMPORT_PATH_TESTS ) .Version=$(VERSION ) "
32
32
CGO_ENABLED? =0
33
33
34
+ # This directory is used in tests hold code coverage results.
35
+ # It's mounted on docker containers which then write code coverage
36
+ # results to it, making coverage profiles available on the host after tests.
37
+ # 777 privileges are important to allow docker container write
38
+ # access to host dir.
39
+ MAKE_TEST_COVER_DIR =mkdir -m 777 -p $(TEST_COVER_DIR )
40
+
34
41
JMX_METRIC_GATHERER_RELEASE =$(shell cat packaging/jmx-metric-gatherer-release.txt)
35
42
SKIP_COMPILE =false
36
43
ARCH? =amd64
@@ -82,57 +89,118 @@ for-all-target: $(ALL_MODS)
82
89
integration-vet :
83
90
@set -e; cd tests && go vet -tags integration,testutilsintegration,zeroconfig,testutils ./... && $(GOTEST_SERIAL ) $(BUILD_INFO_TESTS ) -tags testutils,testutilsintegration -v -timeout 5m -count 1 ./...
84
91
92
+ .PHONY : integration-test-target
93
+ integration-test-target :
94
+ @set -e; cd tests && $(GOTEST_SERIAL ) $(BUILD_INFO_TESTS ) --tags=$(TARGET ) -v -timeout 5m -count 1 ./...
95
+
96
+ .PHONY : integration-test-cover-target
97
+ integration-test-cover-target :
98
+ @set -e; $(MAKE_TEST_COVER_DIR ) && cd tests && $(GOTEST_SERIAL ) $(BUILD_INFO_TESTS ) --tags=$(TARGET ) -v -timeout 5m -count 1 ./... $(COVER_TESTING_INTEGRATION_OPTS )
99
+ $(GOCMD ) tool covdata textfmt -i=$(TEST_COVER_DIR ) -o ./$(TARGET ) -coverage.txt
100
+
85
101
.PHONY : integration-test
86
102
integration-test :
87
- @set -e; cd tests && $(GOTEST_SERIAL ) $(BUILD_INFO_TESTS ) --tags=integration -v -timeout 5m -count 1 ./...
103
+ @make integration-test-target TARGET=' integration'
104
+
105
+ .PHONY : integration-test-with-cover
106
+ integration-test-with-cover :
107
+ @make integration-test-cover-target TARGET=' integration'
88
108
89
109
.PHONY : integration-test-mongodb-discovery
90
110
integration-test-mongodb-discovery :
91
- @set -e; cd tests && $(GOTEST_SERIAL ) $(BUILD_INFO_TESTS ) --tags=discovery_integration_mongodb -v -timeout 5m -count 1 ./...
111
+ @make integration-test TARGET=' discovery_integration_mongodb'
112
+
113
+ .PHONY : integration-test-mongodb-discovery-with-cover
114
+ integration-test-mongodb-discovery-with-cover :
115
+ @make integration-test-cover-target TARGET=' discovery_integration_mongodb'
92
116
93
117
.PHONY : integration-test-mysql-discovery
94
118
integration-test-mysql-discovery :
95
- @set -e; cd tests && $(GOTEST_SERIAL ) $(BUILD_INFO_TESTS ) --tags=discovery_integration_mysql -v -timeout 5m -count 1 ./...
119
+ @make integration-test TARGET=' discovery_integration_mysql'
120
+
121
+ .PHONY : integration-test-mysql-discovery-with-cover
122
+ integration-test-mysql-discovery-with-cover :
123
+ @make integration-test-cover-target TARGET=' discovery_integration_mysql'
96
124
97
125
.PHONY : integration-test-kafkametrics-discovery
98
126
integration-test-kafkametrics-discovery :
99
- @set -e; cd tests && $(GOTEST_SERIAL ) $(BUILD_INFO_TESTS ) --tags=discovery_integration_kafkametrics -v -timeout 5m -count 1 ./...
127
+ @make integration-test TARGET=' discovery_integration_kafkametrics'
128
+
129
+ .PHONY : integration-test-kafkametrics-discovery-with-cover
130
+ integration-test-kafkametrics-discovery-with-cover :
131
+ @make integration-test-cover-target TARGET=' discovery_integration_kafkametrics'
100
132
101
133
.PHONY : integration-test-jmx/cassandra-discovery
102
134
integration-test-jmx/cassandra-discovery :
103
- @set -e; cd tests && $(GOTEST_SERIAL ) $(BUILD_INFO_TESTS ) --tags=discovery_integration_jmx -v -timeout 5m -count 1 ./...
135
+ @make integration-test TARGET=' discovery_integration_jmx'
136
+
137
+ .PHONY : integration-test-jmx/cassandra-discovery-with-cover
138
+ integration-test-jmx/cassandra-discovery-with-cover :
139
+ @make integration-test-cover-target TARGET=' discovery_integration_jmx'
104
140
105
141
.PHONY : integration-test-apache-discovery
106
142
integration-test-apache-discovery :
107
- @set -e; cd tests && $(GOTEST_SERIAL ) $(BUILD_INFO_TESTS ) --tags=discovery_integration_apachewebserver -v -timeout 5m -count 1 ./...
143
+ @make integration-test TARGET=' discovery_integration_apachewebserver'
144
+
145
+ .PHONY : integration-test-apache-discovery-with-cover
146
+ integration-test-apache-discovery-with-cover :
147
+ @make integration-test-cover-target TARGET=' discovery_integration_apachewebserver'
108
148
109
149
.PHONY : integration-test-envoy-discovery
110
150
integration-test-envoy-discovery :
111
- @set -e; cd tests && $(GOTEST_SERIAL ) $(BUILD_INFO_TESTS ) --tags=discovery_integration_envoy -v -timeout 5m -count 1 ./...
151
+ @make integration-test TARGET=' discovery_integration_envoy'
152
+
153
+ .PHONY : integration-test-envoy-discovery-with-cover
154
+ integration-test-envoy-discovery-with-cover :
155
+ @make integration-test-cover-target TARGET=' discovery_integration_envoy'
112
156
113
157
.PHONY : integration-test-nginx-discovery
114
158
integration-test-nginx-discovery :
115
- @set -e; cd tests && $(GOTEST_SERIAL ) $(BUILD_INFO_TESTS ) --tags=discovery_integration_nginx -v -timeout 5m -count 1 ./...
159
+ @make integration-test TARGET=' discovery_integration_nginx'
160
+
161
+ .PHONY : integration-test-nginx-discovery-with-cover
162
+ integration-test-nginx-discovery-with-cover :
163
+ @make integration-test-cover-target TARGET=' discovery_integration_nginx'
116
164
117
165
.PHONY : integration-test-redis-discovery
118
166
integration-test-redis-discovery :
119
- @set -e; cd tests && $(GOTEST_SERIAL ) $(BUILD_INFO_TESTS ) --tags=discovery_integration_redis -v -timeout 5m -count 1 ./...
167
+ @make integration-test TARGET=' discovery_integration_redis'
168
+
169
+ .PHONY : integration-test-redis-discovery-with-cover
170
+ integration-test-redis-discovery-with-cover :
171
+ @make integration-test-cover-target TARGET=' discovery_integration_redis'
120
172
121
173
.PHONY : integration-test-oracledb-discovery
122
174
integration-test-oracledb-discovery :
123
- @set -e; cd tests && $(GOTEST_SERIAL ) $(BUILD_INFO_TESTS ) --tags=discovery_integration_oracledb -v -timeout 5m -count 1 ./...
175
+ @make integration-test TARGET=' discovery_integration_oracledb'
176
+
177
+ .PHONY : integration-test-oracledb-discovery-with-cover
178
+ integration-test-oracledb-discovery-with-cover :
179
+ @make integration-test-cover-target TARGET=' discovery_integration_oracledb'
124
180
125
181
.PHONY : smartagent-integration-test
126
182
smartagent-integration-test :
127
- @set -e; cd tests && $(GOTEST_SERIAL ) $(BUILD_INFO_TESTS ) --tags=smartagent_integration -v -timeout 5m -count 1 ./...
183
+ @make integration-test TARGET=' smartagent_integration'
184
+
185
+ .PHONY : smartagent-integration-test-with-cover
186
+ smartagent-integration-test-with-cover :
187
+ @make integration-test-cover-target TARGET=' smartagent_integration'
128
188
129
189
.PHONY : integration-test-envoy-discovery-k8s
130
190
integration-test-envoy-discovery-k8s :
131
- @set -e; cd tests && $(GOTEST_SERIAL ) $(BUILD_INFO_TESTS ) --tags=discovery_integration_envoy_k8s -v -timeout 5m -count 1 ./...
191
+ @make integration-test TARGET=' discovery_integration_envoy_k8s'
192
+
193
+ .PHONY : integration-test-envoy-discovery-k8s-with-cover
194
+ integration-test-envoy-discovery-k8s-with-cover :
195
+ @make integration-test-cover-target TARGET=' discovery_integration_envoy_k8s'
132
196
133
197
.PHONY : integration-test-istio-discovery-k8s
134
198
integration-test-istio-discovery-k8s :
135
- @set -e; cd tests && $(GOTEST_SERIAL ) $(BUILD_INFO_TESTS ) --tags=discovery_integration_istio_k8s -v -timeout 15m -count 1 ./...
199
+ @make integration-test TARGET=' discovery_integration_istio_k8s'
200
+
201
+ .PHONY : integration-test-istio-discovery-k8s-with-cover
202
+ integration-test-istio-discovery-k8s-with-cover :
203
+ @make integration-test-cover-target TARGET=' discovery_integration_istio_k8s'
136
204
137
205
.PHONY : gotest-with-codecov
138
206
gotest-with-codecov :
181
249
$(LINK_CMD) otelcol_$(GOOS)_$(GOARCH)$(EXTENSION) ./bin/otelcol$(EXTENSION)
182
250
endif
183
251
184
-
185
252
.PHONY : migratecheckpoint
186
253
migratecheckpoint :
187
254
go generate ./...
0 commit comments