mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
postgres: add more tests (to handle zero-rows queries) (#84384)
This commit is contained in:
parent
2420c5aa4d
commit
eca1bba01e
@ -98,6 +98,7 @@ func TestIntegrationPostgresSnapshots(t *testing.T) {
|
||||
format string
|
||||
}{
|
||||
{format: "time_series", name: "simple"},
|
||||
{format: "time_series", name: "no_rows"},
|
||||
{format: "time_series", name: "7x_compat_metric_label"},
|
||||
{format: "time_series", name: "convert_to_float64"},
|
||||
{format: "time_series", name: "convert_to_float64_not"},
|
||||
@ -105,6 +106,7 @@ func TestIntegrationPostgresSnapshots(t *testing.T) {
|
||||
{format: "time_series", name: "fill_previous"},
|
||||
{format: "time_series", name: "fill_value"},
|
||||
{format: "table", name: "simple"},
|
||||
{format: "table", name: "no_rows"},
|
||||
{format: "table", name: "types_numeric"},
|
||||
{format: "table", name: "types_char"},
|
||||
{format: "table", name: "types_datetime"},
|
||||
|
36
pkg/tsdb/grafana-postgresql-datasource/testdata/table/no_rows.golden.jsonc
vendored
Normal file
36
pkg/tsdb/grafana-postgresql-datasource/testdata/table/no_rows.golden.jsonc
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
// 🌟 This was machine generated. Do not edit. 🌟
|
||||
//
|
||||
// Frame[0] {
|
||||
// "typeVersion": [
|
||||
// 0,
|
||||
// 0
|
||||
// ],
|
||||
// "executedQueryString": "SELECT * FROM tbl WHERE false"
|
||||
// }
|
||||
// Name:
|
||||
// Dimensions: 0 Fields by 0 Rows
|
||||
// +
|
||||
// +
|
||||
//
|
||||
//
|
||||
// 🌟 This was machine generated. Do not edit. 🌟
|
||||
{
|
||||
"status": 200,
|
||||
"frames": [
|
||||
{
|
||||
"schema": {
|
||||
"meta": {
|
||||
"typeVersion": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"executedQueryString": "SELECT * FROM tbl WHERE false"
|
||||
},
|
||||
"fields": []
|
||||
},
|
||||
"data": {
|
||||
"values": []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
12
pkg/tsdb/grafana-postgresql-datasource/testdata/table/no_rows.sql
vendored
Normal file
12
pkg/tsdb/grafana-postgresql-datasource/testdata/table/no_rows.sql
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
-- SELECT * FROM tbl WHERE false
|
||||
CREATE TEMPORARY TABLE tbl (
|
||||
"time" timestamp with time zone,
|
||||
v double precision,
|
||||
c text
|
||||
);
|
||||
|
||||
INSERT INTO tbl ("time", v, c) VALUES
|
||||
('2023-12-24 14:30:03 UTC', 10, 'a'),
|
||||
('2023-12-24 14:30:03 UTC', 110, 'b'),
|
||||
('2023-12-24 14:31:03 UTC', 20, 'a'),
|
||||
('2023-12-24 14:31:03 UTC', 120, 'b');
|
36
pkg/tsdb/grafana-postgresql-datasource/testdata/time_series/no_rows.golden.jsonc
vendored
Normal file
36
pkg/tsdb/grafana-postgresql-datasource/testdata/time_series/no_rows.golden.jsonc
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
// 🌟 This was machine generated. Do not edit. 🌟
|
||||
//
|
||||
// Frame[0] {
|
||||
// "typeVersion": [
|
||||
// 0,
|
||||
// 0
|
||||
// ],
|
||||
// "executedQueryString": "SELECT * FROM tbl WHERE false"
|
||||
// }
|
||||
// Name:
|
||||
// Dimensions: 0 Fields by 0 Rows
|
||||
// +
|
||||
// +
|
||||
//
|
||||
//
|
||||
// 🌟 This was machine generated. Do not edit. 🌟
|
||||
{
|
||||
"status": 200,
|
||||
"frames": [
|
||||
{
|
||||
"schema": {
|
||||
"meta": {
|
||||
"typeVersion": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"executedQueryString": "SELECT * FROM tbl WHERE false"
|
||||
},
|
||||
"fields": []
|
||||
},
|
||||
"data": {
|
||||
"values": []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
12
pkg/tsdb/grafana-postgresql-datasource/testdata/time_series/no_rows.sql
vendored
Normal file
12
pkg/tsdb/grafana-postgresql-datasource/testdata/time_series/no_rows.sql
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
-- SELECT * FROM tbl WHERE false
|
||||
CREATE TEMPORARY TABLE tbl (
|
||||
"time" timestamp with time zone,
|
||||
v double precision,
|
||||
c text
|
||||
);
|
||||
|
||||
INSERT INTO tbl ("time", v, c) VALUES
|
||||
('2023-12-24 14:30:03 UTC', 10, 'a'),
|
||||
('2023-12-24 14:30:03 UTC', 110, 'b'),
|
||||
('2023-12-24 14:31:03 UTC', 20, 'a'),
|
||||
('2023-12-24 14:31:03 UTC', 120, 'b');
|
Loading…
Reference in New Issue
Block a user