mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
add resource_history_list test
This commit is contained in:
parent
f6b32c94bd
commit
e8214869de
@ -185,6 +185,29 @@ func TestQueries(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
sqlResourceHistoryList: {
|
||||
{
|
||||
Name: "single path",
|
||||
Data: &sqlResourceHistoryListRequest{
|
||||
SQLTemplate: new(sqltemplate.SQLTemplate),
|
||||
Request: &historyListRequest{
|
||||
Limit: 10,
|
||||
Options: &resource.ListOptions{
|
||||
Key: &resource.ResourceKey{
|
||||
Namespace: "ns",
|
||||
},
|
||||
},
|
||||
},
|
||||
Response: new(resource.ResourceWrapper),
|
||||
},
|
||||
Expected: expected{
|
||||
"resource_history_list_mysql_sqlite.sql": dialects{
|
||||
sqltemplate.MySQL,
|
||||
sqltemplate.SQLite,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
sqlResourceUpdateRV: {
|
||||
{
|
||||
Name: "single path",
|
||||
|
11
pkg/storage/unified/sql/testdata/resource_history_list_mysql_sqlite.sql
vendored
Normal file
11
pkg/storage/unified/sql/testdata/resource_history_list_mysql_sqlite.sql
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
SELECT kv."resource_version", "value"
|
||||
FROM "resource_history" as kv
|
||||
JOIN (
|
||||
SELECT "guid", max("resource_version") AS "resource_version"
|
||||
FROM "resource_history" AS mkv
|
||||
WHERE 1 = 1 AND "resource_version" <= ? AND "namespace" = ?
|
||||
GROUP BY mkv."namespace", mkv."group", mkv."resource", mkv."name"
|
||||
) AS maxkv ON maxkv."guid" = kv."guid"
|
||||
WHERE kv."action" != 3
|
||||
ORDER BY kv."resource_version" ASC
|
||||
LIMIT ?, ?;
|
Loading…
Reference in New Issue
Block a user