package queue import ( "fmt" "loafle.com/overflow/agent_api/observer" "loafle.com/overflow/agent_api/observer/messages" "reflect" "testing" "time" ) func TestNewQueue(t *testing.T) { senderChanel := make(chan interface{}, 0) lq := NewQueue(messages.QUEUE_DATA, 5, senderChanel) fmt.Println(lq) observer.Notify(messages.QUEUE_DATA, "data") observer.Notify(messages.QUEUE_DATA, "data1111") go GetItemTest(senderChanel) time.Sleep(time.Second * 10) lq.Close() close(senderChanel) } func GetItemTest(senderChanel chan interface{}) { for sc := range senderChanel { items := reflect.ValueOf(sc) if items.Kind() != reflect.Slice { fmt.Println("ddddd") } for i := 0; i < items.Len(); i++ { d := items.Index(i) fmt.Println(d) } } }