mirror of
https://github.com/prometheus/alertmanager
synced 2025-02-12 00:17:08 +00:00
Add method to update Alertmanager configuration file
This commit is contained in:
parent
5ba2d4abc1
commit
aab576c7c0
@ -92,10 +92,7 @@ func (t *AcceptanceTest) Alertmanager(conf string) *Alertmanager {
|
||||
t.Fatal(err)
|
||||
}
|
||||
am.confFile = cf
|
||||
|
||||
if _, err := cf.WriteString(conf); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
am.UpdateConfig(conf)
|
||||
|
||||
am.addr = freeAddress()
|
||||
|
||||
@ -268,3 +265,16 @@ func (am *Alertmanager) DelSilence(at float64, sil *TestSilence) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// UpdateConfig rewrites the configuration file for the Alertmanager. It does not
|
||||
// initiate config reloading.
|
||||
func (am *Alertmanager) UpdateConfig(conf string) {
|
||||
if _, err := am.confFile.WriteString(conf); err != nil {
|
||||
am.t.Error(err)
|
||||
return
|
||||
}
|
||||
if err := am.confFile.Sync(); err != nil {
|
||||
am.t.Error(err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user