Commit 7f6754c
committed
test_prometheus_log_exporter: fix wrong measurement unit expected
Unit is now bytes and not kb.
Fix this error:
```
___________________________________ test_550 ___________________________________
plex = <module 'prometheus-log-exporter' from '/home/runner/work/birdhouse-deploy/birdhouse-deploy/birdhouse/optional-components/prometheus-log-parser/config/thredds/prometheus-log-exporter.py'>
def test_550(plex):
log = """172.20.0.1 - - [2025-06-17T03:08:02+00:00] "GET /thredds/catalog.html HTTP/1.1" 302 0 "-" "python-requests/2.31.0" "-"
172.20.0.1 - - [2025-06-17T03:08:02+00:00] "GET /twitcher/ows/proxy/thredds/catalog/catalog.html HTTP/1.0" 200 4200 "-" "python-requests/2.31.0" "172.20.0.1"
172.20.0.1 - - [2025-06-17T03:08:02+00:00] "GET /thredds/catalog/catalog.html HTTP/1.1" 200 4219 "-" "python-requests/2.31.0" "-"
172.20.0.1 - - [2025-06-17T03:08:04+00:00] "GET /twitcher/ows/proxy/thredds/wms/birdhouse/testdata/ta_Amon_MRI-CGCM3_decadal1980_r1i1p1_199101-200012.nc?service=WMS&version=1.3.0&request=GetCapabilities HTTP/1.1" 200 19320 "-" "python-requests/2.31.0" "-"
172.20.0.1 - - [2025-06-17T03:08:06+00:00] "GET /twitcher/ows/proxy/thredds/wms/birdhouse/testdata/ta_Amon_MRI-CGCM3_decadal1980_r1i1p1_199101-200012.nc?service=WMS&version=1.3.0&request=GetCapabilities HTTP/1.1" 200 19320 "-" "python-requests/2.31.0" "-"
172.20.0.1 - - [2025-06-17T03:08:07+00:00] "GET /twitcher/ows/proxy/thredds/wms/birdhouse/testdata/ta_Amon_MRI-CGCM3_decadal1980_r1i1p1_199101-200012.nc?service=WMS&version=1.3.0&request=GetCapabilities HTTP/1.1" 200 19320 "-" "python-requests/2.31.0" "-"
192.168.0.45 - - [2025-06-17T03:08:32+00:00] "GET /twitcher/ows/proxy/thredds/dodsC/birdhouse/testdata/ta_Amon_MRI-CGCM3_decadal1980_r1i1p1_199101-200012.nc.dds HTTP/1.1" 200 584 "-" "oc4.9.2" "-"
192.168.0.45 - - [2025-06-17T03:08:32+00:00] "GET /twitcher/ows/proxy/thredds/dodsC/birdhouse/testdata/ta_Amon_MRI-CGCM3_decadal1980_r1i1p1_199101-200012.nc.das HTTP/1.1" 200 3684 "-" "oc4.9.2" "-"
192.168.0.45 - - [2025-06-17T03:08:32+00:00] "GET /twitcher/ows/proxy/thredds/dodsC/birdhouse/testdata/ta_Amon_MRI-CGCM3_decadal1980_r1i1p1_199101-200012.nc.dds HTTP/1.1" 200 584 "-" "oc4.9.2" "-"
192.168.0.45 - - [2025-06-17T03:08:32+00:00] "GET /twitcher/ows/proxy/thredds/dodsC/birdhouse/testdata/ta_Amon_MRI-CGCM3_decadal1980_r1i1p1_199101-200012.nc.dods?time,time_bnds,plev,lat,lat_bnds,lon,lon_bnds HTTP/1.1" 200 15027 "-" "oc4.9.2" "-"
"""
for line in log.strip().splitlines():
plex.parse_line(line.strip())
samples = list(get_samples(plex.counter.collect(), "thredds_transfer_size_bytes"))
assert len(samples) == 2
s1, s2 = samples
> assert s1.value == (584 + 3684 + 584)/1024, "Total size does not match expected value"
E AssertionError: Total size does not match expected value
E assert 4852.0 == (((584 + 3684) + 584) / 1024)
E + where 4852.0 = Sample(name='thredds_transfer_size_bytes_total', labels={'remote_addr': '192.168.0.45', 'tds_service': 'dodsC', 'datas...adal1980_r1i1p1_199101-200012.nc', 'variable': ''}, value=4852.0, timestamp=None, exemplar=None, native_histogram=None).value
tests/unit/test_prometheus_log_exporter.py:30: AssertionError
```1 parent 2b959d8 commit 7f6754c
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
0 commit comments