mirror of
https://github.com/grafana/grafana.git
synced 2025-02-14 17:43:35 -06:00
* New pfs impl * Reached codegen parity with old system * Update all models.cue inputs * Rename all models.cue files * Remove unused prefixfs * Changes Queries->DataQuery schema interface * Recodegen * All tests passing, nearly good now * Add SchemaInterface to kindsys props * Add pascal name deriver * Relocate plugin cue files again * Clarify use of injected fields * Remove unnecessary aliasing * Move DataQuery into mudball * Allow forcing ExpandReferences on go type generation * Move DataQuery def into kindsys, add generator to copy it to common * Fix copy generator to replace package name correctly * Fix duplicate type, test failure * Fix linting issues
32 lines
923 B
Go
32 lines
923 B
Go
package pfs
|
|
|
|
import (
|
|
"sort"
|
|
"testing"
|
|
|
|
"github.com/google/go-cmp/cmp"
|
|
"github.com/grafana/grafana/pkg/kindsys"
|
|
)
|
|
|
|
// This is a brick-dumb test that just ensures known schema interfaces are being
|
|
// loaded correctly from their declarations in .cue files.
|
|
//
|
|
// If this test fails, it's either because:
|
|
// - They're not being loaded correctly - there's a bug in kindsys or pfs somewhere, fix it
|
|
// - The set of schema interfaces has been modified - update the static list here
|
|
func TestSchemaInterfacesAreLoaded(t *testing.T) {
|
|
knownSI := []string{"PanelCfg", "DataQuery", "DataSourceCfg"}
|
|
all := kindsys.SchemaInterfaces(nil)
|
|
var loadedSI []string
|
|
for k := range all {
|
|
loadedSI = append(loadedSI, k)
|
|
}
|
|
|
|
sort.Strings(knownSI)
|
|
sort.Strings(loadedSI)
|
|
|
|
if diff := cmp.Diff(knownSI, loadedSI); diff != "" {
|
|
t.Fatalf("kindsys cue-declared schema interfaces differ from ComposableKinds go struct:\n%s", diff)
|
|
}
|
|
}
|