PluginProxy: Split implementations of token providers (#32820)

* Split implementations of token providers

* Fix imports

* Fix code racing in unit tests
This commit is contained in:
Sergey Kostrukov
2021-05-03 02:46:32 -10:00
committed by GitHub
parent c1034f3118
commit 19f520d891
7 changed files with 215 additions and 125 deletions

View File

@ -249,7 +249,10 @@ func TestDataSourceProxy_routeRule(t *testing.T) {
json, err := ioutil.ReadFile("./test-data/access-token-1.json")
require.NoError(t, err)
originalClient := client
client = newFakeHTTPClient(t, json)
defer func() { client = originalClient }()
proxy, err := NewDataSourceProxy(ds, plugin, ctx, "pathwithtoken1", &setting.Cfg{})
require.NoError(t, err)
ApplyRoute(proxy.ctx.Req.Context(), req, proxy.proxyPath, plugin.Routes[0], proxy.ds)