Skip to content

Commit

Permalink
Add fixture update helper (prometheus#1551)
Browse files Browse the repository at this point in the history
* Add makefile target to update sysfs fixtures.
* Use similar style for fixtures from procfs.
* Re-pack fixtures ttar file.

Signed-off-by: Ben Kochie <superq@gmail.com>
  • Loading branch information
SuperQ authored and oblitorum committed Apr 9, 2024
1 parent 9b16bac commit e52d292
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
12 changes: 8 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,16 @@ test-32bit: collector/fixtures/sys/.unpacked
skip-test-32bit:
@echo ">> SKIP running tests in 32-bit mode: not supported on $(GOHOSTOS)/$(GOHOSTARCH)"

collector/fixtures/sys/.unpacked: collector/fixtures/sys.ttar
@echo ">> extracting sysfs fixtures"
if [ -d collector/fixtures/sys ] ; then rm -r collector/fixtures/sys ; fi
./ttar -C collector/fixtures -x -f collector/fixtures/sys.ttar
%/.unpacked: %.ttar
@echo ">> extracting fixtures"
if [ -d $(dir $@) ] ; then rm -r $(dir $@) ; fi
./ttar -C $(dir $*) -x -f $*.ttar
touch $@

update_fixtures:
rm -vf collector/fixtures/sys/.unpacked
./ttar -C collector/fixtures -c -f collector/fixtures/sys.ttar sys

.PHONY: test-e2e
test-e2e: build collector/fixtures/sys/.unpacked
@echo ">> running end-to-end tests"
Expand Down
16 changes: 4 additions & 12 deletions collector/fixtures/sys.ttar
Original file line number Diff line number Diff line change
Expand Up @@ -298,11 +298,6 @@ Lines: 1
0
Mode: 644
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Path: sys/class/infiniband/mlx4_0/ports/1/counters/port_xmit_discards
Lines: 1
0
Mode: 644
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Path: sys/class/infiniband/mlx4_0/ports/1/counters/port_rcv_errors
Lines: 1
0
Expand Down Expand Up @@ -1278,15 +1273,16 @@ Path: sys/class/power_supply/BAT0/voltage_now
Lines: 1
11660000
Mode: 444
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Directory: sys/class/thermal
Mode: 755
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Path: sys/class/thermal/thermal_zone0
SymlinkTo: ../../devices/virtual/thermal/thermal_zone0
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Path: sys/class/thermal/cooling_device0
SymlinkTo: ../../devices/virtual/thermal/cooling_device0
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Path: sys/class/thermal/thermal_zone0
SymlinkTo: ../../devices/virtual/thermal/thermal_zone0
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Directory: sys/devices
Mode: 755
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Expand Down Expand Up @@ -3200,7 +3196,3 @@ Lines: 1
20
Mode: 644
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Path: sys/.unpacked
Lines: 0
Mode: 644
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

0 comments on commit e52d292

Please sign in to comment.