Skip to content

Commit 89da702

Browse files
committed
chore(bench): Make benchmarks more robust
1 parent 6a938f6 commit 89da702

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

internal/server/postgres/dataserverimpl_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,7 +1472,10 @@ func BenchmarkPostgresClient(b *testing.B) {
14721472
},
14731473
)
14741474
require.NoError(b, err)
1475-
require.GreaterOrEqual(b, len(resp.Values), 1)
1475+
// There is a forecast value every 30 minutes, and the window is 84 hours long
1476+
// But the forecast made at the pivot time is the latest one, and that is only
1477+
// tt.ForecastLengthHours long
1478+
require.Equal(b, (48+tt.ForecastLengthHours)*60/tt.PgvResolutionMins, len(resp.Values))
14761479
}
14771480
})
14781481
b.Run(fmt.Sprintf("%d/GetForecastAtTimestamp", output.NumPgvs), func(b *testing.B) {
@@ -1495,7 +1498,7 @@ func BenchmarkPostgresClient(b *testing.B) {
14951498
)
14961499
require.NoError(b, err)
14971500
require.NotNil(b, crossSectionResp)
1498-
require.GreaterOrEqual(b, len(crossSectionResp.Values), 1)
1501+
require.Equal(b, len(output.LocationUuids), len(crossSectionResp.Values))
14991502
}
15001503
})
15011504
b.Run(fmt.Sprintf("%d/GetObservationsAsTimeseries", output.NumPgvs), func(b *testing.B) {

0 commit comments

Comments
 (0)