@@ -19,46 +19,83 @@ run *args: build
19
19
- e BASIC_AUTH_USER=$BASIC_AUTH_USER \
20
20
- e BASIC_AUTH_PASSWORD=$BASIC_AUTH_PASSWORD \
21
21
- e HONEYCOMB_KEY \
22
+ - e GRAFANA_INSTANCE_ID \
23
+ - e GRAFANA_API_TOKEN \
22
24
{{ args }} {{ IMAGE_NAME }}
23
25
24
26
25
- # run integration test. You will need a HONEYCOMB_KEY set in the environment
27
+ # run integration test. You will need keys for Honeycomb & Grafana set in the environment
26
28
test-integration : venv
27
29
#!/ bin/ bash
28
30
set -euo pipefail
29
31
30
32
{{ just_executable () }} run -d -e LOG_LEVEL=debug -p 4318 :4318
31
33
{{ just_executable () }} run-python tests.py
32
- echo " Data sent to honeycomb"
34
+ echo " Data sent to honeycomb and grafana "
33
35
echo " https://ui.honeycomb.io/bennett-institute-for-applied-data-science/environments/development/datasets/otel-gateway-tests?query=%7B%22time_range%22%3A600%2C%22granularity%22%3A0%2C%22breakdowns%22%3A%5B%5D%2C%22calculations%22%3A%5B%5D%2C%22orders%22%3A%5B%5D%2C%22havings%22%3A%5B%5D%2C%22limit%22%3A100%7D"
34
36
35
37
36
- # spin up a pretend honeycomb and run tests
37
- test-ci : venv
38
+ _ mock_honeycomb_start :
38
39
#!/ bin/ bash
39
40
set -euo pipefail
40
41
41
- mkdir -p exported
42
+ mkdir -p exported/ honeycomb
42
43
43
44
# run a different instance of a collector as a test endpoint
44
45
docker rm --force mock-honeycomb 2 >/ dev/ null || true
45
46
docker run -d -p 4319 :4318 --name mock-honeycomb -u " $(id -u):$(id -g)" \
46
- - v $PWD/ test -config.yaml:/ etc/ otelcol-contrib/ config.yaml \
47
- - v $PWD/ exported:/ exported \
47
+ - v $PWD/ mock-honeycomb -config.yaml:/ etc/ otelcol-contrib/ config.yaml \
48
+ - v $PWD/ exported/ honeycomb :/ exported \
48
49
otel/ opentelemetry-collector-contrib:0.62.1
49
50
50
51
test " $(docker inspect mock-honeycomb -f '{{{{.State.Status}}')" == " running" || { docker logs mock-honeycomb; exit 1 ; }
51
52
52
- export ENDPOINT=" http://host.docker.internal:4319"
53
+ _ mock_honeycomb_stop :
54
+ docker stop mock-honeycomb
55
+
56
+ _ mock_grafana_start :
57
+ #!/ bin/ bash
58
+ set -euo pipefail
59
+
60
+ mkdir -p exported/ grafana
61
+
62
+ # run a different instance of a collector as a test endpoint
63
+ docker rm --force mock-grafana 2 >/ dev/ null || true
64
+ docker run -d -p 4320 :4318 --name mock-grafana -u " $(id -u):$(id -g)" \
65
+ - v $PWD/ mock-grafana-config.yaml:/ etc/ otelcol-contrib/ config.yaml \
66
+ - v $PWD/ exported/ grafana:/ exported \
67
+ - e GRAFANA_INSTANCE_ID \
68
+ - e GRAFANA_API_TOKEN \
69
+ otel/ opentelemetry-collector-contrib:0.62.1
70
+
71
+ test " $(docker inspect mock-grafana -f '{{{{.State.Status}}')" == " running" || { docker logs mock-grafana; exit 1 ; }
72
+
73
+ _ mock_grafana_stop :
74
+ docker stop mock-grafana
75
+
76
+ # run tests against mock upstream servers
77
+ test-ci : venv _mock_honeycomb_start _mock_grafana_start && _mock_honeycomb_stop _mock_grafana_stop
78
+ #!/ bin/ bash
79
+ set -euo pipefail
80
+
81
+ export HONEYCOMB_ENDPOINT=" http://host.docker.internal:4319"
82
+ export GRAFANA_ENDPOINT=" http://host.docker.internal:4320"
53
83
54
84
# run otel-gateway pointing at the test endpoint
55
- {{ just_executable () }} run -d -e ENDPOINT -e LOG_LEVEL=debug -p 4318 :4318 --add-host=host.docker.internal:host-gateway
85
+ {{ just_executable () }} run -d \
86
+ - e HONEYCOMB_ENDPOINT \
87
+ - e GRAFANA_ENDPOINT \
88
+ - e GRAFANA_INSTANCE_ID \
89
+ - e GRAFANA_API_TOKEN \
90
+ - e LOG_LEVEL=debug \
91
+ - p 4318 :4318 \
92
+ - -add-host=host.docker.internal:host-gateway
56
93
57
94
test " $(docker inspect otel-gateway -f '{{{{.State.Status}}')" == " running" || { docker logs otel-gateway; exit 1 ; }
58
95
{{ just_executable () }} run-python -m pytest tests.py
59
96
60
97
docker stop otel-gateway
61
- docker stop mock-honeycomb
98
+
62
99
63
100
# run a python script in the correct environment
64
101
run-python * args : venv
0 commit comments