mirror of
https://github.com/grafana/grafana.git
synced 2024-11-29 20:24:18 -06:00
8745d7ef1b
* extract kindsys * reinstate kindsys report This may end up living somewhere else (or not! who knows!), but the important part is that I don't get rid of it right now :) I hate the package layout (kindsysreport/codegen) for the main function and will take pretty much any alternative suggestion, but we can change also change it later. Note that the generated report.json is in a different location - anything using this (ops something) needs to be updated. * kindsysreport in codeowners
32 lines
911 B
Go
32 lines
911 B
Go
package pfs
|
|
|
|
import (
|
|
"sort"
|
|
"testing"
|
|
|
|
"github.com/google/go-cmp/cmp"
|
|
"github.com/grafana/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)
|
|
}
|
|
}
|