mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Remove public vars in setting package (#81018)
Removes the public variable setting.SecretKey plus some other ones. Introduces some new functions for creating setting.Cfg.
This commit is contained in:
committed by
GitHub
parent
147bf01745
commit
6768c6c059
@@ -71,7 +71,7 @@ func TestNotificationService(t *testing.T) {
|
||||
|
||||
notificationServiceScenario(t, "Given alert rule with upload image enabled and render times out should send notification",
|
||||
evalCtx, true, func(sc *scenarioContext) {
|
||||
setting.AlertingNotificationTimeout = 200 * time.Millisecond
|
||||
sc.notificationService.cfg.AlertingNotificationTimeout = 200 * time.Millisecond
|
||||
sc.renderProvider = func(ctx context.Context, opts rendering.Opts) (*rendering.RenderResult, error) {
|
||||
wait := make(chan bool)
|
||||
|
||||
@@ -101,7 +101,7 @@ func TestNotificationService(t *testing.T) {
|
||||
|
||||
notificationServiceScenario(t, "Given alert rule with upload image enabled and upload times out should send notification",
|
||||
evalCtx, true, func(sc *scenarioContext) {
|
||||
setting.AlertingNotificationTimeout = 200 * time.Millisecond
|
||||
sc.notificationService.cfg.AlertingNotificationTimeout = 200 * time.Millisecond
|
||||
sc.uploadProvider = func(ctx context.Context, path string) (string, error) {
|
||||
wait := make(chan bool)
|
||||
|
||||
@@ -204,8 +204,6 @@ func notificationServiceScenario(t *testing.T, name string, evalCtx *EvalContext
|
||||
}, nil
|
||||
}
|
||||
|
||||
setting.AlertingNotificationTimeout = 30 * time.Second
|
||||
|
||||
scenarioCtx := &scenarioContext{
|
||||
t: t,
|
||||
evalCtx: evalCtx,
|
||||
@@ -229,7 +227,7 @@ func notificationServiceScenario(t *testing.T, name string, evalCtx *EvalContext
|
||||
}
|
||||
|
||||
origNewImageUploaderProvider := newImageUploaderProvider
|
||||
newImageUploaderProvider = func() (imguploader.ImageUploader, error) {
|
||||
newImageUploaderProvider = func(cfg *setting.Cfg) (imguploader.ImageUploader, error) {
|
||||
return imageUploader, nil
|
||||
}
|
||||
defer func() {
|
||||
@@ -258,7 +256,8 @@ func notificationServiceScenario(t *testing.T, name string, evalCtx *EvalContext
|
||||
},
|
||||
}
|
||||
|
||||
scenarioCtx.notificationService = newNotificationService(renderService, store, nil, nil)
|
||||
scenarioCtx.notificationService = newNotificationService(setting.NewCfg(), renderService, store, nil, nil)
|
||||
scenarioCtx.notificationService.cfg.AlertingNotificationTimeout = 30 * time.Second
|
||||
fn(scenarioCtx)
|
||||
})
|
||||
}
|
||||
@@ -274,7 +273,7 @@ type testNotifier struct {
|
||||
Frequency time.Duration
|
||||
}
|
||||
|
||||
func newTestNotifier(model *alertmodels.AlertNotification, _ GetDecryptedValueFn, ns notifications.Service) (Notifier, error) {
|
||||
func newTestNotifier(_ *setting.Cfg, model *alertmodels.AlertNotification, _ GetDecryptedValueFn, ns notifications.Service) (Notifier, error) {
|
||||
uploadImage := true
|
||||
value, exist := model.Settings.CheckGet("uploadImage")
|
||||
if exist {
|
||||
|
||||
Reference in New Issue
Block a user