.
This commit is contained in:
@@ -4,6 +4,8 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
"time"
|
||||
"loafle.com/overflow/agent_api/observer/messages"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type Test struct {
|
||||
@@ -85,7 +87,7 @@ func TestMultiAddObserver(t *testing.T) {
|
||||
Notify("test", Test{Id: "test"})
|
||||
|
||||
time.Sleep(2 * time.Second)
|
||||
Remove("test", ch1)
|
||||
Remove(messages.CRAWLER_ADD, ch1)
|
||||
Remove("test", ch2)
|
||||
Remove("test", ch3)
|
||||
Remove("test", ch4)
|
||||
@@ -95,3 +97,18 @@ func TestMultiAddObserver(t *testing.T) {
|
||||
time.Sleep(1 * time.Second)
|
||||
|
||||
}
|
||||
|
||||
|
||||
func TestStringNotify(t *testing.T) {
|
||||
ch := make(chan interface{},0)
|
||||
Add("test",ch)
|
||||
|
||||
go func() {
|
||||
data :=<-ch
|
||||
str := data.(string)
|
||||
fmt.Println(str)
|
||||
}()
|
||||
|
||||
Notify("test","testsetasetaset")
|
||||
time.Sleep(1 * time.Second)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user