You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
497 B

  1. package messages
  2. import (
  3. "testing"
  4. "time"
  5. )
  6. func TestAddMessage(t *testing.T) {
  7. mp := NewMessagePipeline(0, 3, 10, time.Second, &EmptyMover{})
  8. go func() {
  9. outChan := mp.OutputChan()
  10. for mr := range outChan {
  11. println(mr.sequence, mr.fileId)
  12. }
  13. }()
  14. for i := 0; i < 100; i++ {
  15. message := &Message{
  16. Key: []byte("key"),
  17. Content: []byte("data"),
  18. Properties: nil,
  19. Ts: time.Now(),
  20. }
  21. mp.AddMessage(message)
  22. }
  23. mp.ShutdownStart()
  24. mp.ShutdownWait()
  25. }