console: fix intermittent failure when requesting previous period

Notably when the main table is required, but also on rare conditions
when another table would be selected because of the interval selection.

This is not perfect as sometimes, we won't have the data.
This commit is contained in:
Vincent Bernat
2025-07-16 20:46:35 +02:00
parent d3d80c1dbf
commit 5e826d48b1
5 changed files with 81 additions and 21 deletions

View File

@@ -183,7 +183,7 @@ func TestFinalizeQuery(t *testing.T) {
},
Expected: "SELECT 1 FROM flows WHERE TimeReceived BETWEEN toDateTime('2022-04-10 15:45:10', 'UTC') AND toDateTime('2022-04-11 15:45:10', 'UTC') // 30",
}, {
Description: "use flows table for resolution (but flows_1m0s for data)",
Description: "use flows table for resolution and for data",
Tables: []flowsTable{
{"flows", 0, time.Date(2022, 4, 10, 10, 45, 10, 0, time.UTC)},
{"flows_1m0s", time.Minute, time.Date(2022, 3, 10, 10, 45, 10, 0, time.UTC)},
@@ -198,7 +198,7 @@ func TestFinalizeQuery(t *testing.T) {
}(),
Points: 2880, // 30-second resolution
},
Expected: "SELECT 1 FROM flows_1m0s WHERE TimeReceived BETWEEN toDateTime('2022-03-10 15:45:10', 'UTC') AND toDateTime('2022-03-11 15:45:10', 'UTC') // 30",
Expected: "SELECT 1 FROM flows WHERE TimeReceived BETWEEN toDateTime('2022-03-10 15:45:10', 'UTC') AND toDateTime('2022-03-11 15:45:10', 'UTC') // 30",
}, {
Description: "select flows table with better resolution",
Tables: []flowsTable{