mirror of
https://github.com/grafana/grafana.git
synced 2025-07-31 15:32:27 +08:00
Backend plugins: Refactor to allow shared contract between core and external backend plugins (#25472)
Refactor to allow shared contract between core and external backend plugins allowing core backend data sources in Grafana to be implemented in same way as an external backend plugin. Use v0.67.0 of sdk. Add tests for verifying plugin is restarted when process is killed. Enable strict linting for backendplugin packages
This commit is contained in:

committed by
GitHub

parent
40b3473a10
commit
c0f3b2929c
29
pkg/plugins/backendplugin/grpcplugin/log_wrapper_test.go
Normal file
29
pkg/plugins/backendplugin/grpcplugin/log_wrapper_test.go
Normal file
@ -0,0 +1,29 @@
|
||||
package grpcplugin
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestLogWrapper(t *testing.T) {
|
||||
tcs := []struct {
|
||||
args []interface{}
|
||||
expectedResult []interface{}
|
||||
}{
|
||||
{args: []interface{}{}, expectedResult: []interface{}{}},
|
||||
{args: []interface{}{"1", "2", "3"}, expectedResult: []interface{}{"1", "2", "3"}},
|
||||
{args: []interface{}{"1", "2"}, expectedResult: []interface{}{"1", "2"}},
|
||||
{args: []interface{}{"1", "2", "timestamp", time.Now()}, expectedResult: []interface{}{"1", "2"}},
|
||||
{args: []interface{}{"1", "2", "timestamp", time.Now(), "3", "4"}, expectedResult: []interface{}{"1", "2", "3", "4"}},
|
||||
}
|
||||
|
||||
for i, tc := range tcs {
|
||||
t.Run(fmt.Sprintf("formatArgs testcase %d", i), func(t *testing.T) {
|
||||
res := formatArgs(tc.args...)
|
||||
assert.Exactly(t, tc.expectedResult, res)
|
||||
})
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user