Dashboards: Remove panel plugin provider from migrations (#110477)

This commit is contained in:
Ryan McKinley
2025-09-04 14:17:22 +03:00
committed by GitHub
parent 3d009ff7ed
commit 8052ecb3ba
23 changed files with 143 additions and 518 deletions
@@ -4,7 +4,6 @@ import (
"testing"
"github.com/grafana/grafana/apps/dashboard/pkg/migration/schemaversion"
"github.com/grafana/grafana/apps/dashboard/pkg/migration/testutil"
)
func TestV28(t *testing.T) {
@@ -88,7 +87,8 @@ func TestV28(t *testing.T) {
},
"overrides": []interface{}{},
},
"pluginVersion": "1.0.0",
"pluginVersion": pluginVersionForAutoMigrate,
"targets": []interface{}{
map[string]interface{}{"refId": "A"},
},
@@ -176,7 +176,7 @@ func TestV28(t *testing.T) {
},
"overrides": []interface{}{},
},
"pluginVersion": "1.0.0",
"pluginVersion": pluginVersionForAutoMigrate,
"targets": []interface{}{
map[string]interface{}{"refId": "A"},
},
@@ -257,7 +257,7 @@ func TestV28(t *testing.T) {
},
"overrides": []interface{}{},
},
"pluginVersion": "1.0.0",
"pluginVersion": pluginVersionForAutoMigrate,
"targets": []interface{}{
map[string]interface{}{"refId": "A"},
},
@@ -324,7 +324,7 @@ func TestV28(t *testing.T) {
},
"overrides": []interface{}{},
},
"pluginVersion": "1.0.0",
"pluginVersion": pluginVersionForAutoMigrate,
"targets": []interface{}{
map[string]interface{}{"refId": "A"},
},
@@ -391,7 +391,7 @@ func TestV28(t *testing.T) {
},
"overrides": []interface{}{},
},
"pluginVersion": "1.0.0",
"pluginVersion": pluginVersionForAutoMigrate,
"targets": []interface{}{
map[string]interface{}{"refId": "A"},
},
@@ -491,7 +491,7 @@ func TestV28(t *testing.T) {
},
"overrides": []interface{}{},
},
"pluginVersion": "1.0.0",
"pluginVersion": pluginVersionForAutoMigrate,
"targets": []interface{}{
map[string]interface{}{"refId": "A"},
},
@@ -556,7 +556,7 @@ func TestV28(t *testing.T) {
},
"overrides": []interface{}{},
},
"pluginVersion": "1.0.0",
"pluginVersion": pluginVersionForAutoMigrate,
"targets": []interface{}{
map[string]interface{}{"refId": "A"},
},
@@ -621,7 +621,7 @@ func TestV28(t *testing.T) {
},
"overrides": []interface{}{},
},
"pluginVersion": "1.0.0",
"pluginVersion": pluginVersionForAutoMigrate,
"targets": []interface{}{
map[string]interface{}{"refId": "A"},
},
@@ -696,7 +696,7 @@ func TestV28(t *testing.T) {
},
"overrides": []interface{}{},
},
"pluginVersion": "1.0.0",
"pluginVersion": pluginVersionForAutoMigrate,
"targets": []interface{}{
map[string]interface{}{"refId": "A"},
},
@@ -746,46 +746,5 @@ func TestV28(t *testing.T) {
},
}
errorTests := []migrationTestCase{
{
name: "throw an error if stat panel plugin not found",
input: map[string]interface{}{
"schemaVersion": 27,
"panels": []interface{}{
map[string]interface{}{
"id": 1,
"type": "singlestat",
"valueName": "avg",
"format": "ms",
"decimals": 2,
"thresholds": "10,20,30",
"colors": []interface{}{"green", "yellow", "red"},
"gauge": map[string]interface{}{
"show": false,
},
"targets": []interface{}{
map[string]interface{}{"refId": "A"},
},
},
},
"templating": map[string]interface{}{
"list": []interface{}{
map[string]interface{}{
"name": "var1",
"tags": []interface{}{"tag1"},
"tagsQuery": "query",
"tagValuesQuery": "values",
"useTags": true,
},
},
},
},
expectedError: "schema migration from version 28 to 41 failed: stat panel plugin not found when migrating dashboard to schema version 28",
},
}
runMigrationTests(t, tests, schemaversion.V28(testutil.GetTestPanelProvider()))
runMigrationTests(t, errorTests, schemaversion.V28(testutil.GetTestPanelProviderWithCustomPanels([]schemaversion.PanelPluginInfo{
{ID: "fake-plugin", Version: "1.0.0"},
})))
runMigrationTests(t, tests, schemaversion.V28)
}