Plugins: Make grafana-com API URL usage consistent (#86920)

Plugins: Fix grafana-com API URL usage
This commit is contained in:
Hugo Kiyodi Oshiro
2024-04-26 16:47:38 +02:00
committed by GitHub
parent 85c23eed38
commit 7783b16e47
8 changed files with 13 additions and 13 deletions
@@ -115,7 +115,7 @@ func (kr *KeyRetriever) downloadKeys(ctx context.Context) error {
Items []ManifestKeys
}
url, err := url.JoinPath(kr.cfg.GrafanaComURL, "/api/plugins/ci/keys") // nolint:gosec URL is provided by config
url, err := url.JoinPath(kr.cfg.GrafanaComAPIURL, "/plugins/ci/keys") // nolint:gosec URL is provided by config
if err != nil {
return err
}
@@ -45,7 +45,7 @@ func Test_PublicKeyUpdate(t *testing.T) {
cfg := &setting.Cfg{}
expectedKey := "fake"
s, done := setFakeAPIServer(t, expectedKey, "7e4d0c6a708866e7")
cfg.GrafanaComURL = s.URL
cfg.GrafanaComAPIURL = s.URL + "/api"
v := ProvideService(cfg, keystore.ProvideService(kvstore.NewFakeKVStore()))
go func() {
err := v.Run(context.Background())
@@ -66,7 +66,7 @@ func Test_PublicKeyUpdate(t *testing.T) {
cfg := &setting.Cfg{}
expectedKey := "fake"
s, done := setFakeAPIServer(t, expectedKey, "7e4d0c6a708866e7")
cfg.GrafanaComURL = s.URL
cfg.GrafanaComAPIURL = s.URL + "/api"
v := ProvideService(cfg, keystore.ProvideService(kvstore.NewFakeKVStore()))
go func() {
err := v.Run(context.Background())
@@ -86,7 +86,7 @@ func Test_PublicKeyUpdate(t *testing.T) {
cfg := &setting.Cfg{}
expectedKey := "fake"
s, done := setFakeAPIServer(t, expectedKey, "other")
cfg.GrafanaComURL = s.URL
cfg.GrafanaComAPIURL = s.URL + "/api"
v := ProvideService(cfg, keystore.ProvideService(kvstore.NewFakeKVStore()))
go func() {
err := v.Run(context.Background())
@@ -113,7 +113,7 @@ func Test_PublicKeyUpdate(t *testing.T) {
}
expectedKey := "fake"
s, done := setFakeAPIServer(t, expectedKey, "7e4d0c6a708866e7")
cfg.GrafanaComURL = s.URL
cfg.GrafanaComAPIURL = s.URL + "/api"
v := ProvideService(cfg, keystore.ProvideService(kvstore.NewFakeKVStore()))
// Simulate an updated key
err := v.kv.SetLastUpdated(context.Background())