diff --git a/pkg/cmd/grafana-cli/commands/scuemata_validation_command_test.go b/pkg/cmd/grafana-cli/commands/scuemata_validation_command_test.go index 408d46b0381..07ed9bdae4e 100644 --- a/pkg/cmd/grafana-cli/commands/scuemata_validation_command_test.go +++ b/pkg/cmd/grafana-cli/commands/scuemata_validation_command_test.go @@ -1,8 +1,6 @@ package commands import ( - "embed" - "io/fs" "os" "path/filepath" "testing" @@ -12,17 +10,13 @@ import ( "github.com/stretchr/testify/require" ) -//go:embed testdata/public/*/*.cue testdata/public/*/plugin.json -var base embed.FS -var pluginSchema, _ = fs.Sub(base, "testdata/public") - func TestValidateScuemataBasics(t *testing.T) { t.Run("Testing scuemata validity with valid cue schemas", func(t *testing.T) { tempDir := os.DirFS(filepath.Join("testdata", "valid_scuemata")) var baseLoadPaths = load.BaseLoadPaths{ BaseCueFS: tempDir, - DistPluginCueFS: pluginSchema, + DistPluginCueFS: load.GetDefaultLoadPaths().DistPluginCueFS, } err := validate(baseLoadPaths, load.BaseDashboardFamily) @@ -37,7 +31,7 @@ func TestValidateScuemataBasics(t *testing.T) { var baseLoadPaths = load.BaseLoadPaths{ BaseCueFS: tempDir, - DistPluginCueFS: pluginSchema, + DistPluginCueFS: load.GetDefaultLoadPaths().DistPluginCueFS, } err := validate(baseLoadPaths, load.BaseDashboardFamily) @@ -49,7 +43,7 @@ func TestValidateScuemataBasics(t *testing.T) { var baseLoadPaths = load.BaseLoadPaths{ BaseCueFS: tempDir, - DistPluginCueFS: pluginSchema, + DistPluginCueFS: load.GetDefaultLoadPaths().DistPluginCueFS, } err := validate(baseLoadPaths, load.BaseDashboardFamily) diff --git a/pkg/cmd/grafana-cli/commands/testdata/invalid_scuemata_missing_family/cue/scuemata/panel-plugin.cue b/pkg/cmd/grafana-cli/commands/testdata/invalid_scuemata_missing_family/cue/scuemata/panel-plugin.cue index 98d010b44dd..fdf29dc968b 100644 --- a/pkg/cmd/grafana-cli/commands/testdata/invalid_scuemata_missing_family/cue/scuemata/panel-plugin.cue +++ b/pkg/cmd/grafana-cli/commands/testdata/invalid_scuemata_missing_family/cue/scuemata/panel-plugin.cue @@ -9,6 +9,7 @@ package scuemata #PanelSchema: { PanelOptions: {...} PanelFieldConfig: {...} + ... } // A lineage of panel schema diff --git a/pkg/cmd/grafana-cli/commands/testdata/invalid_scuemata_missing_panel/cue/scuemata/panel-plugin.cue b/pkg/cmd/grafana-cli/commands/testdata/invalid_scuemata_missing_panel/cue/scuemata/panel-plugin.cue index 98d010b44dd..3d15e9d8381 100644 --- a/pkg/cmd/grafana-cli/commands/testdata/invalid_scuemata_missing_panel/cue/scuemata/panel-plugin.cue +++ b/pkg/cmd/grafana-cli/commands/testdata/invalid_scuemata_missing_panel/cue/scuemata/panel-plugin.cue @@ -8,7 +8,8 @@ package scuemata // the larger Dashboard schema. #PanelSchema: { PanelOptions: {...} - PanelFieldConfig: {...} + PanelFieldConfig?: {...} + ... } // A lineage of panel schema diff --git a/pkg/cmd/grafana-cli/commands/testdata/public/dashlist/models.cue b/pkg/cmd/grafana-cli/commands/testdata/public/dashlist/models.cue deleted file mode 100644 index 377cc998d20..00000000000 --- a/pkg/cmd/grafana-cli/commands/testdata/public/dashlist/models.cue +++ /dev/null @@ -1,22 +0,0 @@ -package grafanaschema - -Family: { - lineages: [ - [ - { - PanelOptions: { - showStarred: bool | *true - showRecentlyViewed: bool | *false - showSearch: bool | *false - showHeadings: bool | *true - maxItems: int | *10 - query: string | *"" - folderId?: int - tags: [...string] | *[] - }, - PanelFieldConfig: {} - } - ] - ] - migrations: [] -} diff --git a/pkg/cmd/grafana-cli/commands/testdata/public/dashlist/plugin.json b/pkg/cmd/grafana-cli/commands/testdata/public/dashlist/plugin.json deleted file mode 100644 index de8f6fd15bb..00000000000 --- a/pkg/cmd/grafana-cli/commands/testdata/public/dashlist/plugin.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "type": "panel", - "name": "Dashboard list", - "id": "dashlist", - "skipDataQuery": true, - "info": { - "description": "List of dynamic links to other dashboards", - "author": { - "name": "Grafana Labs", - "url": "https://grafana.com" - }, - "logos": { - "small": "img/icn-dashlist-panel.svg", - "large": "img/icn-dashlist-panel.svg" - } - } -} diff --git a/pkg/cmd/grafana-cli/commands/testdata/valid_scuemata/cue/data/gen.cue b/pkg/cmd/grafana-cli/commands/testdata/valid_scuemata/cue/data/gen.cue index 1a0440c9764..28e52d6a92e 100644 --- a/pkg/cmd/grafana-cli/commands/testdata/valid_scuemata/cue/data/gen.cue +++ b/pkg/cmd/grafana-cli/commands/testdata/valid_scuemata/cue/data/gen.cue @@ -10,7 +10,7 @@ Family: scuemata.#Family & { // TODO must isolate or remove identifiers local to a Grafana instance...? id?: number // Unique dashboard identifier that can be generated by anyone. string (8-40) - uid?: string + uid: string // Title of dashboard. title?: string // Description of dashboard. diff --git a/pkg/cmd/grafana-cli/commands/testdata/valid_scuemata/cue/scuemata/panel-plugin.cue b/pkg/cmd/grafana-cli/commands/testdata/valid_scuemata/cue/scuemata/panel-plugin.cue index 98d010b44dd..f4953838f48 100644 --- a/pkg/cmd/grafana-cli/commands/testdata/valid_scuemata/cue/scuemata/panel-plugin.cue +++ b/pkg/cmd/grafana-cli/commands/testdata/valid_scuemata/cue/scuemata/panel-plugin.cue @@ -7,8 +7,9 @@ package scuemata // rather, they are composed into panel structures as they are defined within // the larger Dashboard schema. #PanelSchema: { - PanelOptions: {...} - PanelFieldConfig: {...} + PanelOptions: {...} + PanelFieldConfig?: {...} + ... } // A lineage of panel schema @@ -16,6 +17,6 @@ package scuemata // Panel plugin-specific Family #PanelFamily: { - lineages: [#PanelLineage, ...#PanelLineage] - migrations: [...#Migration] + lineages: [#PanelLineage, ...#PanelLineage] + migrations: [...#Migration] }