mirror of
https://github.com/prometheus-community/postgres_exporter
synced 2025-04-09 18:51:25 +00:00
Fix untyped integer overflows on 32-bit archs (#857)
go-sqlmock's Rows.AddRow() takes values which have a type alias of "any", and appear to default to untyped ints if not explicitly cast. When large values are passed which would overflow int32, tests fail. Signed-off-by: Daniel Swarbrick <daniel.swarbrick@gmail.com>
This commit is contained in:
parent
a6012e0b54
commit
2477aba363
@ -51,7 +51,7 @@ func TestPGStatBGWriterCollector(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
rows := sqlmock.NewRows(columns).
|
rows := sqlmock.NewRows(columns).
|
||||||
AddRow(354, 4945, 289097744, 1242257, 3275602074, 89320867, 450139, 2034563757, 0, 2725688749, srT)
|
AddRow(354, 4945, 289097744, 1242257, int64(3275602074), 89320867, 450139, 2034563757, 0, int64(2725688749), srT)
|
||||||
mock.ExpectQuery(sanitizeQuery(statBGWriterQuery)).WillReturnRows(rows)
|
mock.ExpectQuery(sanitizeQuery(statBGWriterQuery)).WillReturnRows(rows)
|
||||||
|
|
||||||
ch := make(chan prometheus.Metric)
|
ch := make(chan prometheus.Metric)
|
||||||
|
@ -67,12 +67,12 @@ func TestPGStatDatabaseCollector(t *testing.T) {
|
|||||||
4945,
|
4945,
|
||||||
289097744,
|
289097744,
|
||||||
1242257,
|
1242257,
|
||||||
3275602074,
|
int64(3275602074),
|
||||||
89320867,
|
89320867,
|
||||||
450139,
|
450139,
|
||||||
2034563757,
|
2034563757,
|
||||||
0,
|
0,
|
||||||
2725688749,
|
int64(2725688749),
|
||||||
23,
|
23,
|
||||||
52,
|
52,
|
||||||
74,
|
74,
|
||||||
@ -263,12 +263,12 @@ func TestPGStatDatabaseCollectorRowLeakTest(t *testing.T) {
|
|||||||
4945,
|
4945,
|
||||||
289097744,
|
289097744,
|
||||||
1242257,
|
1242257,
|
||||||
3275602074,
|
int64(3275602074),
|
||||||
89320867,
|
89320867,
|
||||||
450139,
|
450139,
|
||||||
2034563757,
|
2034563757,
|
||||||
0,
|
0,
|
||||||
2725688749,
|
int64(2725688749),
|
||||||
23,
|
23,
|
||||||
52,
|
52,
|
||||||
74,
|
74,
|
||||||
|
Loading…
Reference in New Issue
Block a user