Alerting: Make Unified Alerting enabled by default for those who do not use legacy alerting (#42200)

* update AlertingEnabled and UnifiedAlertingSettings.Enabled to be pointers
* add a pseudo migration to fix the AlertingEnabled and UnifiedAlertingSettings.Enabled if the latter is not defined
* update the default configuration file to make default value for both 'enabled' flags be undefined

Misc
* update Migrator to expose DB engine. This is needed for a ualert migration to access the database while the list of migrations is created.
* add more verbose failure when migrations do not match

Co-authored-by: gotjosh <josue@grafana.com>
Co-authored-by: Yuriy Tseretyan <yuriy.tseretyan@grafana.com>
Co-authored-by: gillesdemey <gilles.de.mey@gmail.com>
This commit is contained in:
Armand Grillet
2021-11-24 20:56:07 +01:00
committed by GitHub
parent 1c261aea8e
commit 6523486122
19 changed files with 352 additions and 180 deletions

View File

@@ -219,7 +219,8 @@ func TestMiddlewareQuota(t *testing.T) {
}, func(cfg *setting.Cfg) {
configure(cfg)
cfg.UnifiedAlerting.Enabled = true
cfg.UnifiedAlerting.Enabled = new(bool)
*cfg.UnifiedAlerting.Enabled = true
cfg.Quota.Org.AlertRule = quotaUsed
})
@@ -233,7 +234,8 @@ func TestMiddlewareQuota(t *testing.T) {
}, func(cfg *setting.Cfg) {
configure(cfg)
cfg.UnifiedAlerting.Enabled = true
cfg.UnifiedAlerting.Enabled = new(bool)
*cfg.UnifiedAlerting.Enabled = true
cfg.Quota.Org.AlertRule = quotaUsed + 1
})