Implement reinject command to send notifications of alerts (#1638)

* implement reinject command to send notifications of alerts using a profile

Co-authored-by: sabban <15465465+sabban@users.noreply.github.com>
This commit is contained in:
Manuel Sabban 2022-08-30 15:45:52 +02:00 committed by GitHub
parent 21255b6391
commit 7d0f89df29
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 200 additions and 29 deletions

View file

@ -14,8 +14,9 @@ import (
var ctx = context.Background()
func resetTestTomb(testTomb *tomb.Tomb) {
func resetTestTomb(testTomb *tomb.Tomb, pw *PluginWatcher) {
testTomb.Kill(nil)
<-pw.PluginEvents
if err := testTomb.Wait(); err != nil {
log.Fatal(err)
}
@ -64,8 +65,7 @@ func TestPluginWatcherInterval(t *testing.T) {
defer cancel()
err := listenChannelWithTimeout(ct, pw.PluginEvents)
assert.ErrorContains(t, err, "context deadline exceeded")
resetTestTomb(&testTomb)
resetTestTomb(&testTomb, &pw)
testTomb = tomb.Tomb{}
pw.Start(&testTomb)
@ -73,7 +73,7 @@ func TestPluginWatcherInterval(t *testing.T) {
defer cancel()
err = listenChannelWithTimeout(ct, pw.PluginEvents)
assert.NilError(t, err)
resetTestTomb(&testTomb)
resetTestTomb(&testTomb, &pw)
// This is to avoid the int complaining
}
@ -113,5 +113,5 @@ func TestPluginAlertCountWatcher(t *testing.T) {
defer cancel()
err = listenChannelWithTimeout(ct, pw.PluginEvents)
assert.NilError(t, err)
resetTestTomb(&testTomb)
resetTestTomb(&testTomb, &pw)
}