diff --git a/pkg/notifications/shoutrrr_test.go b/pkg/notifications/shoutrrr_test.go index 89b86dd..703958b 100644 --- a/pkg/notifications/shoutrrr_test.go +++ b/pkg/notifications/shoutrrr_test.go @@ -83,6 +83,30 @@ updt1 (mock/updt1:latest): Updated }) }) + When("adding a log hook", func() { + When("it has not been added before", func() { + It("should be added to the logrus hooks", func() { + level := logrus.TraceLevel + hooksBefore := len(logrus.StandardLogger().Hooks[level]) + shoutrrr := createNotifier([]string{}, level, "", true, StaticData{}, false, time.Second) + shoutrrr.AddLogHook() + hooksAfter := len(logrus.StandardLogger().Hooks[level]) + Expect(hooksAfter).To(BeNumerically(">", hooksBefore)) + }) + }) + When("it is being added a second time", func() { + It("should not be added to the logrus hooks", func() { + level := logrus.TraceLevel + shoutrrr := createNotifier([]string{}, level, "", true, StaticData{}, false, time.Second) + shoutrrr.AddLogHook() + hooksBefore := len(logrus.StandardLogger().Hooks[level]) + shoutrrr.AddLogHook() + hooksAfter := len(logrus.StandardLogger().Hooks[level]) + Expect(hooksAfter).To(Equal(hooksBefore)) + }) + }) + }) + When("using legacy templates", func() { When("no custom template is provided", func() {