mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Data Source Proxy: Migrate proxy to its own service and make more extensible (#31927)
* datasource proxy extensions * revert normalresponse extensions * data proxy service impl * lint * api datasource proxy method * moves datasource proxy tests into correct new pkg
This commit is contained in:
34
pkg/services/datasourceproxy/datasourceproxy_test.go
Normal file
34
pkg/services/datasourceproxy/datasourceproxy_test.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package datasourceproxy
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestDataProxy(t *testing.T) {
|
||||
t.Run("extractProxyPath", func(t *testing.T) {
|
||||
testCases := []struct {
|
||||
originalRawPath string
|
||||
exp string
|
||||
}{
|
||||
{
|
||||
"/api/datasources/proxy/1",
|
||||
"",
|
||||
},
|
||||
{
|
||||
"/api/datasources/proxy/1/some/thing",
|
||||
"some/thing",
|
||||
},
|
||||
{
|
||||
"/api/datasources/proxy/54/api/services/afsd%2Fafsd/operations",
|
||||
"api/services/afsd%2Fafsd/operations",
|
||||
},
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
t.Run("Given raw path, should extract expected proxy path", func(t *testing.T) {
|
||||
assert.Equal(t, tc.exp, extractProxyPath(tc.originalRawPath))
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user