-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
79 lines (69 loc) · 2.01 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
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
GOCMD = go
GOTESTCMD = $(if $(shell command -v gotestsum),gotestsum --junitfile ./test_results/$(1).xml --format testname --,go test)
.PHONY: test
#: run all tests
test: test_with_race test_all
.PHONY: test_with_race
#: run only tests tagged with potential race conditions
test_with_race: test_results
@echo
@echo "+++ testing - race conditions?"
@echo
$(call GOTESTCMD,$@) -tags race --race --timeout 60s -v ./...
.PHONY: test_all
#: run all tests, but with no race condition detection
test_all: test_results
@echo
@echo "+++ testing - all the tests"
@echo
$(call GOTESTCMD,$@) -tags all --timeout 60s -v ./...
test_results:
@mkdir -p test_results
tidy:
$(GOCMD) mod tidy
TEMPLATE ?= pkg/config/templates/emathroughput
.PHONY: test_template
#: generate config from template (usage: make test_template TEMPLATE=pkg/config/templates/proxy)
test_template:
@echo
@echo "+++ generating config from template $(TEMPLATE)"
@echo
./testTemplate.sh $(TEMPLATE)
CONFIG ?= examples/hpsf.yaml
.PHONY: validate
#: validate provided config (usage: make validate CONFIG=examples/hpsf2.yaml)
validate:
@echo
@echo "+++ validating config $(CONFIG)"
@echo
go run ./cmd/hpsf -i $(CONFIG) validate
for format in rConfig rRules cConfig ; do \
echo; \
echo "+++ validating config generation for $${format} with config $(CONFIG)"; \
echo; \
go run ./cmd/hpsf -i $(CONFIG) $${format} || exit 1; \
done
.PHONY: validate_all
validate_all: examples/hpsf* pkg/data/templates/*
for file in $^ ; do \
$(MAKE) validate CONFIG=$${file} || exit 1; \
done
.PHONY: smoke
smoke:
@echo
@echo "+++ basic smoke test - does it start?"
@echo "+++ if so, make unsmoke after this"
@echo
mkdir -p tmp
go run ./cmd/hpsf -i ./examples/hpsfProxy.yaml -o tmp/hpsfProxy.cconfig.yaml cConfig
docker run --rm -it \
--name smoke-proxy \
-p 4227-4228:4227-4228 \
-v ./tmp/hpsfProxy.cconfig.yaml:/etc/otelcol/config.yaml \
otel/opentelemetry-collector:latest
.PHONY: unsmoke
unsmoke:
@echo
@echo "+++ stopping smoke test"
@echo
docker stop smoke-proxy