(t *testing.T)
| 421 | } |
| 422 | |
| 423 | func TestIsValidSubscriber(t *testing.T) { |
| 424 | s := RunDefaultServer() |
| 425 | defer s.Shutdown() |
| 426 | |
| 427 | nc := NewDefaultConnection(t) |
| 428 | defer nc.Close() |
| 429 | |
| 430 | sub, err := nc.SubscribeSync("foo") |
| 431 | if err != nil { |
| 432 | t.Fatalf("Error on subscribe: %v", err) |
| 433 | } |
| 434 | if !sub.IsValid() { |
| 435 | t.Fatalf("Subscription should be valid") |
| 436 | } |
| 437 | for range 10 { |
| 438 | nc.Publish("foo", []byte("Hello")) |
| 439 | } |
| 440 | nc.Flush() |
| 441 | _, err = sub.NextMsg(200 * time.Millisecond) |
| 442 | if err != nil { |
| 443 | t.Fatalf("NextMsg returned an error") |
| 444 | } |
| 445 | sub.Unsubscribe() |
| 446 | _, err = sub.NextMsg(200 * time.Millisecond) |
| 447 | if err == nil { |
| 448 | t.Fatalf("NextMsg should have returned an error") |
| 449 | } |
| 450 | } |
| 451 | |
| 452 | func TestSlowSubscriber(t *testing.T) { |
| 453 | s := RunDefaultServer() |
nothing calls this directly
no test coverage detected