mirror of
https://github.com/containrrr/watchtower.git
synced 2026-01-09 18:48:50 +01:00
add test for log hook guard
This commit is contained in:
parent
57c42fd7bd
commit
d7213d237a
1 changed files with 24 additions and 0 deletions
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue