summaryrefslogtreecommitdiff
path: root/events
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-10-27 14:41:57 +0300
committerValery Piashchynski <[email protected]>2021-10-27 14:41:57 +0300
commite9fe3e11da095ca5569ca59739c97c862fe7fade (patch)
treebd35404612366cb3e13a79311667fb6281dc16c0 /events
parenta244937265a14e10c0217d42d2aa893d3ab1535c (diff)
unsubscribe from the bus in the tests
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'events')
-rw-r--r--events/events_test.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/events/events_test.go b/events/events_test.go
index afe64d12..6d6e90a2 100644
--- a/events/events_test.go
+++ b/events/events_test.go
@@ -9,6 +9,7 @@ import (
func TestEvenHandler(t *testing.T) {
eh, id := Bus()
+ defer eh.Unsubscribe(id)
ch := make(chan Event, 100)
err := eh.SubscribeP(id, "http.EventJobOK", ch)
@@ -25,6 +26,8 @@ func TestEvenHandler(t *testing.T) {
func TestEvenHandler2(t *testing.T) {
eh, id := Bus()
eh2, id2 := Bus()
+ defer eh.Unsubscribe(id)
+ defer eh2.Unsubscribe(id2)
ch := make(chan Event, 100)
ch2 := make(chan Event, 100)
@@ -59,6 +62,7 @@ func TestEvenHandler2(t *testing.T) {
func TestEvenHandler3(t *testing.T) {
eh, id := Bus()
+ defer eh.Unsubscribe(id)
ch := make(chan Event, 100)
err := eh.SubscribeP(id, "EventJobOK", ch)
@@ -67,6 +71,7 @@ func TestEvenHandler3(t *testing.T) {
func TestEvenHandler4(t *testing.T) {
eh, id := Bus()
+ defer eh.Unsubscribe(id)
err := eh.SubscribeP(id, "EventJobOK", nil)
require.Error(t, err)
@@ -74,6 +79,7 @@ func TestEvenHandler4(t *testing.T) {
func TestEvenHandler5(t *testing.T) {
eh, id := Bus()
+ defer eh.Unsubscribe(id)
ch := make(chan Event, 100)
err := eh.SubscribeP(id, "http.EventJobOK", ch)