Kindsys: Unify plugins, pfs with kind framework (#61192)

* 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
This commit is contained in:
sam boyer
2023-01-20 04:41:35 -05:00
committed by GitHub
parent 6a7cbeae6c
commit 3b3059c9ce
91 changed files with 2192 additions and 1870 deletions

View File

@@ -13,7 +13,7 @@ import (
"github.com/stretchr/testify/require"
)
func TestParseTreeTestdata(t *testing.T) {
func TestParsePluginTestdata(t *testing.T) {
type tt struct {
tfs fs.FS
// TODO could remove this by getting rid of inconsistent subdirs
@@ -110,11 +110,8 @@ func TestParseTreeTestdata(t *testing.T) {
"no-rootfile": {
err: ErrNoRootFile,
},
"valid-model-panel": {},
"valid-model-datasource": {},
"wrong-slot-panel": {
err: ErrImplementedSlots,
},
"valid-model-panel": {},
"valid-model-datasource": {},
"missing-kind-datasource": {},
"panel-conflicting-joinschema": {
err: ErrInvalidLineage,
@@ -124,11 +121,8 @@ func TestParseTreeTestdata(t *testing.T) {
err: ErrInvalidLineage,
skip: "TODO implement BindOption in thema, SatisfiesJoinSchema, then use it here",
},
"name-id-mismatch": {
err: ErrLineageNameMismatch,
},
"mismatch": {
err: ErrLineageNameMismatch,
"name-mismatch-panel": {
err: ErrInvalidGrafanaPluginInstance,
},
"disallowed-cue-import": {
err: ErrDisallowedCUEImport,
@@ -170,11 +164,12 @@ func TestParseTreeTestdata(t *testing.T) {
t.Skip(tst.skip)
}
tree, err := ParsePluginFS(tst.tfs, lib)
pp, err := ParsePluginFS(tst.tfs, lib)
if tst.err == nil {
require.NoError(t, err, "unexpected error while parsing plugin tree")
} else {
require.Error(t, err)
t.Logf("%T %s", err, err)
require.ErrorIs(t, err, tst.err, "unexpected error type while parsing plugin tree")
return
}
@@ -183,8 +178,7 @@ func TestParseTreeTestdata(t *testing.T) {
tst.rootid = name
}
rootp := tree.RootPlugin()
require.Equal(t, tst.rootid, rootp.Meta().Id, "expected root plugin id and actual root plugin id differ")
require.Equal(t, tst.rootid, pp.Properties.Id, "expected plugin id and actual plugin id differ")
})
}
}
@@ -270,11 +264,11 @@ func TestParseTreeZips(t *testing.T) {
t.Skip(tst.skip)
}
tree, err := ParsePluginFS(tst.tfs, lib)
pp, err := ParsePluginFS(tst.tfs, lib)
if tst.err == nil {
require.NoError(t, err, "unexpected error while parsing plugin tree")
require.NoError(t, err, "unexpected error while parsing plugin fs")
} else {
require.ErrorIs(t, err, tst.err, "unexpected error type while parsing plugin tree")
require.ErrorIs(t, err, tst.err, "unexpected error type while parsing plugin fs")
return
}
@@ -282,8 +276,7 @@ func TestParseTreeZips(t *testing.T) {
tst.rootid = name
}
rootp := tree.RootPlugin()
require.Equal(t, tst.rootid, rootp.Meta().Id, "expected root plugin id and actual root plugin id differ")
require.Equal(t, tst.rootid, pp.Properties.Id, "expected plugin id and actual plugin id differ")
})
}
}