mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 07:32:13 +08:00
Backend Plugins: Convert test data source to use SDK contracts (#29916)
Converts the core testdata data source to use the SDK contracts and by that implementing a backend plugin in core Grafana in similar manner as an external one. Co-authored-by: Will Browne <will.browne@grafana.com> Co-authored-by: Marcus Efraimsson <marefr@users.noreply.github.com> Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
This commit is contained in:

committed by
GitHub

parent
b838125ef7
commit
043d6cd584
@ -11,7 +11,6 @@ import (
|
||||
)
|
||||
|
||||
// corePlugin represents a plugin that's part of Grafana core.
|
||||
// nolint:unused
|
||||
type corePlugin struct {
|
||||
pluginID string
|
||||
logger log.Logger
|
||||
@ -55,7 +54,7 @@ func (cp *corePlugin) Stop(ctx context.Context) error {
|
||||
}
|
||||
|
||||
func (cp *corePlugin) IsManaged() bool {
|
||||
return false
|
||||
return true
|
||||
}
|
||||
|
||||
func (cp *corePlugin) Exited() bool {
|
||||
|
@ -19,7 +19,7 @@ func TestCorePlugin(t *testing.T) {
|
||||
require.NotNil(t, p)
|
||||
require.NoError(t, p.Start(context.Background()))
|
||||
require.NoError(t, p.Stop(context.Background()))
|
||||
require.False(t, p.IsManaged())
|
||||
require.True(t, p.IsManaged())
|
||||
require.False(t, p.Exited())
|
||||
|
||||
_, err = p.CollectMetrics(context.Background())
|
||||
@ -50,7 +50,7 @@ func TestCorePlugin(t *testing.T) {
|
||||
require.NotNil(t, p)
|
||||
require.NoError(t, p.Start(context.Background()))
|
||||
require.NoError(t, p.Stop(context.Background()))
|
||||
require.False(t, p.IsManaged())
|
||||
require.True(t, p.IsManaged())
|
||||
require.False(t, p.Exited())
|
||||
|
||||
_, err = p.CollectMetrics(context.Background())
|
||||
|
Reference in New Issue
Block a user