Resource server improvements and fixes (#90715)

* cleanup dependencies and improve list method
* Improve Resource Server API, remove unnecessary dependencies
* Reduce the API footprint of ResourceDBInterface and its implementation
* Improve LifecycleHooks to use context
* Improve testing
* reduce API size and improve code
* sqltemplate: add DialectForDriver func and improve naming
* improve lifecycle API
* many small fixes after adding more tests
This commit is contained in:
Diego Augusto Molina
2024-07-22 20:08:30 +03:00
committed by GitHub
parent 5f367f05dc
commit 399d77a0fd
28 changed files with 2193 additions and 945 deletions
@@ -4,8 +4,9 @@ import (
"fmt"
"testing"
"github.com/grafana/grafana/pkg/setting"
"github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/setting"
)
var invalidUTF8ByteSequence = []byte{0xff, 0xfe, 0xfd}
@@ -44,7 +45,7 @@ func TestSectionGetter(t *testing.T) {
v = g.String(key)
require.Empty(t, v)
require.Error(t, g.Err())
require.ErrorIs(t, g.Err(), ErrInvalidUTF8Sequence)
require.ErrorIs(t, g.Err(), errInvalidUTF8Sequence)
}
func TestMakeDSN(t *testing.T) {
@@ -55,7 +56,7 @@ func TestMakeDSN(t *testing.T) {
})
require.Empty(t, s)
require.Error(t, err)
require.ErrorIs(t, err, ErrInvalidUTF8Sequence)
require.ErrorIs(t, err, errInvalidUTF8Sequence)
s, err = MakeDSN(map[string]string{
"skip": "",