Skip to content

Commit 73cff08

Browse files
committed
only run tests for contrib, still need to catch the expected output
1 parent d892556 commit 73cff08

File tree

4 files changed

+84
-101
lines changed

4 files changed

+84
-101
lines changed

.github/workflows/base-ci-goreleaser.yaml

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -307,34 +307,16 @@ jobs:
307307
exit 1
308308
fi
309309
310-
golden-tests:
311-
needs:
312-
- check-goreleaser
313-
runs-on: ubuntu-24.04
314-
steps:
315-
- name: Checkout
316-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
317-
318-
- name: Download container image artifact
319-
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
320-
with:
321-
name: ${{ inputs.distribution }}-image-${{ needs.check-goreleaser.outputs.version }}-linux-amd64
322-
323-
- name: Load image into docker
324-
run: |
325-
docker image load --input ./${{ inputs.distribution }}.tar
326-
docker image ls
327-
docker image inspect ${{ inputs.distribution }}:${{ needs.check-goreleaser.outputs.version }}-linux-amd64
328-
329310
- name: Run golden tests
311+
if: matrix.GOOS == 'linux' && matrix.GOARCH == 'amd64' && inputs.distribution == 'otelcol-contrib'
330312
run: |
331313
echo "Running golden tests..."
332314
cd tests/golden
333-
IMG=${{ inputs.distribution }}:${{ needs.check-goreleaser.outputs.version }}-linux-amd64 docker compose up -d --wait
315+
MY_UID="$(id -u)" MY_GID="$(id -g)" IMG=${{ inputs.distribution }}:${{ needs.check-goreleaser.outputs.version }}-${{ matrix.GOOS }}-${{ matrix.GOARCH }} docker compose up -d --wait
334316
exit_code=$(docker wait golden)
335317
docker logs golden
318+
cat /tmp/expected.yaml
336319
if [ "$exit_code" -ne 0 ]; then
337320
docker logs collector
338-
cat /tmp/expected.yaml
339321
exit 1
340-
fi
322+
fi

.github/workflows/ci-goreleaser-contrib.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,4 @@ jobs:
4848
with:
4949
distribution: otelcol-contrib
5050
type: '[ "msi" ]'
51+

tests/golden/data/expected.yaml

Lines changed: 76 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,28 @@ resourceMetrics:
66
stringValue: "8888"
77
- key: service.instance.id
88
value:
9-
stringValue: 05888d0b-74c6-4a82-86a2-79e2fcdf72c0
9+
stringValue: 5b9402ef-3537-4fbe-a15e-cca161089476
1010
- key: service.name
1111
value:
1212
stringValue: otelcol-contrib
1313
- key: service.version
1414
value:
15-
stringValue: 0.131.1
15+
stringValue: 0.131.0
1616
- key: url.scheme
1717
value:
1818
stringValue: http
1919
scopeMetrics:
2020
- metrics:
21+
- description: The number of samples remaining after metric relabeling was applied
22+
gauge:
23+
dataPoints:
24+
- asDouble: 9
25+
timeUnixNano: "1000000"
26+
metadata:
27+
- key: prometheus.type
28+
value:
29+
stringValue: gauge
30+
name: scrape_samples_post_metric_relabeling
2131
- description: Cumulative bytes allocated for heap objects (see 'go doc runtime.MemStats.TotalAlloc') [alpha]
2232
metadata:
2333
- key: prometheus.type
@@ -27,17 +37,17 @@ resourceMetrics:
2737
sum:
2838
aggregationTemporality: 2
2939
dataPoints:
30-
- asDouble: 3.0636648e+07
40+
- asDouble: 3.0289392e+07
3141
attributes:
3242
- key: service.instance.id
3343
value:
34-
stringValue: 05888d0b-74c6-4a82-86a2-79e2fcdf72c0
44+
stringValue: 5b9402ef-3537-4fbe-a15e-cca161089476
3545
- key: service.name
3646
value:
3747
stringValue: otelcol-contrib
3848
- key: service.version
3949
value:
40-
stringValue: 0.131.1
50+
stringValue: 0.131.0
4151
startTimeUnixNano: "1000000"
4252
timeUnixNano: "1000000"
4353
isMonotonic: true
@@ -50,17 +60,17 @@ resourceMetrics:
5060
sum:
5161
aggregationTemporality: 2
5262
dataPoints:
53-
- asDouble: 6.833103003
63+
- asDouble: 6.577890098
5464
attributes:
5565
- key: service.instance.id
5666
value:
57-
stringValue: 05888d0b-74c6-4a82-86a2-79e2fcdf72c0
67+
stringValue: 5b9402ef-3537-4fbe-a15e-cca161089476
5868
- key: service.name
5969
value:
6070
stringValue: otelcol-contrib
6171
- key: service.version
6272
value:
63-
stringValue: 0.131.1
73+
stringValue: 0.131.0
6474
startTimeUnixNano: "1000000"
6575
timeUnixNano: "1000000"
6676
isMonotonic: true
@@ -88,67 +98,6 @@ resourceMetrics:
8898
startTimeUnixNano: "1000000"
8999
timeUnixNano: "1000000"
90100
isMonotonic: true
91-
- description: Duration of the scrape
92-
gauge:
93-
dataPoints:
94-
- asDouble: 0.0049495
95-
timeUnixNano: "1000000"
96-
metadata:
97-
- key: prometheus.type
98-
value:
99-
stringValue: gauge
100-
name: scrape_duration_seconds
101-
unit: s
102-
- description: The number of samples remaining after metric relabeling was applied
103-
gauge:
104-
dataPoints:
105-
- asDouble: 9
106-
timeUnixNano: "1000000"
107-
metadata:
108-
- key: prometheus.type
109-
value:
110-
stringValue: gauge
111-
name: scrape_samples_post_metric_relabeling
112-
- description: Bytes of allocated heap objects (see 'go doc runtime.MemStats.HeapAlloc') [alpha]
113-
gauge:
114-
dataPoints:
115-
- asDouble: 1.9421984e+07
116-
attributes:
117-
- key: service.instance.id
118-
value:
119-
stringValue: 05888d0b-74c6-4a82-86a2-79e2fcdf72c0
120-
- key: service.name
121-
value:
122-
stringValue: otelcol-contrib
123-
- key: service.version
124-
value:
125-
stringValue: 0.131.1
126-
timeUnixNano: "1000000"
127-
metadata:
128-
- key: prometheus.type
129-
value:
130-
stringValue: gauge
131-
name: otelcol_process_runtime_heap_alloc_bytes
132-
- description: Total bytes of memory obtained from the OS (see 'go doc runtime.MemStats.Sys') [alpha]
133-
gauge:
134-
dataPoints:
135-
- asDouble: 3.7311752e+07
136-
attributes:
137-
- key: service.instance.id
138-
value:
139-
stringValue: 05888d0b-74c6-4a82-86a2-79e2fcdf72c0
140-
- key: service.name
141-
value:
142-
stringValue: otelcol-contrib
143-
- key: service.version
144-
value:
145-
stringValue: 0.131.1
146-
timeUnixNano: "1000000"
147-
metadata:
148-
- key: prometheus.type
149-
value:
150-
stringValue: gauge
151-
name: otelcol_process_runtime_total_sys_memory_bytes
152101
- description: The scraping was successful
153102
gauge:
154103
dataPoints:
@@ -188,40 +137,91 @@ resourceMetrics:
188137
sum:
189138
aggregationTemporality: 2
190139
dataPoints:
191-
- asDouble: 0.06999999999999999
140+
- asDouble: 0.11
192141
attributes:
193142
- key: service.instance.id
194143
value:
195-
stringValue: 05888d0b-74c6-4a82-86a2-79e2fcdf72c0
144+
stringValue: 5b9402ef-3537-4fbe-a15e-cca161089476
196145
- key: service.name
197146
value:
198147
stringValue: otelcol-contrib
199148
- key: service.version
200149
value:
201-
stringValue: 0.131.1
150+
stringValue: 0.131.0
202151
startTimeUnixNano: "1000000"
203152
timeUnixNano: "1000000"
204153
isMonotonic: true
205154
- description: Total physical memory (resident set size) [alpha]
206155
gauge:
207156
dataPoints:
208-
- asDouble: 1.72449792e+08
157+
- asDouble: 1.78987008e+08
209158
attributes:
210159
- key: service.instance.id
211160
value:
212-
stringValue: 05888d0b-74c6-4a82-86a2-79e2fcdf72c0
161+
stringValue: 5b9402ef-3537-4fbe-a15e-cca161089476
213162
- key: service.name
214163
value:
215164
stringValue: otelcol-contrib
216165
- key: service.version
217166
value:
218-
stringValue: 0.131.1
167+
stringValue: 0.131.0
219168
timeUnixNano: "1000000"
220169
metadata:
221170
- key: prometheus.type
222171
value:
223172
stringValue: gauge
224173
name: otelcol_process_memory_rss
174+
- description: Bytes of allocated heap objects (see 'go doc runtime.MemStats.HeapAlloc') [alpha]
175+
gauge:
176+
dataPoints:
177+
- asDouble: 2.0282512e+07
178+
attributes:
179+
- key: service.instance.id
180+
value:
181+
stringValue: 5b9402ef-3537-4fbe-a15e-cca161089476
182+
- key: service.name
183+
value:
184+
stringValue: otelcol-contrib
185+
- key: service.version
186+
value:
187+
stringValue: 0.131.0
188+
timeUnixNano: "1000000"
189+
metadata:
190+
- key: prometheus.type
191+
value:
192+
stringValue: gauge
193+
name: otelcol_process_runtime_heap_alloc_bytes
194+
- description: Total bytes of memory obtained from the OS (see 'go doc runtime.MemStats.Sys') [alpha]
195+
gauge:
196+
dataPoints:
197+
- asDouble: 3.1544584e+07
198+
attributes:
199+
- key: service.instance.id
200+
value:
201+
stringValue: 5b9402ef-3537-4fbe-a15e-cca161089476
202+
- key: service.name
203+
value:
204+
stringValue: otelcol-contrib
205+
- key: service.version
206+
value:
207+
stringValue: 0.131.0
208+
timeUnixNano: "1000000"
209+
metadata:
210+
- key: prometheus.type
211+
value:
212+
stringValue: gauge
213+
name: otelcol_process_runtime_total_sys_memory_bytes
214+
- description: Duration of the scrape
215+
gauge:
216+
dataPoints:
217+
- asDouble: 0.001617155
218+
timeUnixNano: "1000000"
219+
metadata:
220+
- key: prometheus.type
221+
value:
222+
stringValue: gauge
223+
name: scrape_duration_seconds
224+
unit: s
225225
scope:
226226
name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver
227-
version: 0.131.1
227+
version: 0.131.0

tests/golden/docker-compose.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ services:
1010
golden:
1111
container_name: golden
1212
image: ghcr.io/open-telemetry/opentelemetry-collector-contrib/golden:latest
13+
user: ${MY_UID}:${MY_GID}
1314
volumes:
1415
- ./data:/var/data
15-
- /tmp:/tmp
1616
command: >-
17-
--expected /tmp/expected.yaml
17+
--expected /var/data/expected.yaml
1818
--otlp-http-endpoint 0.0.0.0:4318
1919
--otlp-endpoint 0.0.0.0:4317
2020
--ignore-timestamp
@@ -32,4 +32,4 @@ services:
3232
--ignore-metric-values
3333
--ignore-data-points-attributes-order
3434
--ignore-scope-version
35-
--write-expected
35+
#--write-expected

0 commit comments

Comments
 (0)