prometheus-community / postgres_exporter

A PostgreSQL metric exporter for Prometheus
Apache License 2.0
2.83k stars 745 forks source link

Fix test build failures on 32-bit arch again #919

Closed dswarbrick closed 1 year ago

dswarbrick commented 1 year ago

Another case of untyped integer overflows on 32-bit arch.

Fixes failed test build:

$ GOARCH=386 go test ./...
# github.com/prometheus-community/postgres_exporter/collector [github.com/prometheus-community/postgres_exporter/collector.test]
collector/pg_stat_walreceiver_test.go:67:4: cannot use 1200668684563608 (untyped int constant) as int value in argument to sqlmock.NewRows(columns).AddRow (overflows)
collector/pg_stat_walreceiver_test.go:69:4: cannot use 1200668684563609 (untyped int constant) as int value in argument to sqlmock.NewRows(columns).AddRow (overflows)
collector/pg_stat_walreceiver_test.go:73:4: cannot use 1200668684563610 (untyped int constant) as int value in argument to sqlmock.NewRows(columns).AddRow (overflows)
collector/pg_stat_walreceiver_test.go:146:4: cannot use 1200668684563608 (untyped int constant) as int value in argument to sqlmock.NewRows(columns).AddRow (overflows)
collector/pg_stat_walreceiver_test.go:151:4: cannot use 1200668684563610 (untyped int constant) as int value in argument to sqlmock.NewRows(columns).AddRow (overflows)
ok      github.com/prometheus-community/postgres_exporter/cmd/postgres_exporter 0.007s
FAIL    github.com/prometheus-community/postgres_exporter/collector [build failed]
ok      github.com/prometheus-community/postgres_exporter/config        0.005s
FAIL

Please consider adding 32-bit builds / tests to CI, so that these are caught automatically in future.

Refs: #844

SuperQ commented 1 year ago

Easy: https://github.com/prometheus-community/postgres_exporter/pull/920