(t *testing.T)
| 652 | } |
| 653 | |
| 654 | func TestContextRequestConnClosed(t *testing.T) { |
| 655 | s := RunDefaultServer() |
| 656 | defer s.Shutdown() |
| 657 | |
| 658 | nc := NewDefaultConnection(t) |
| 659 | ctx, cancelCB := context.WithCancel(context.Background()) |
| 660 | defer cancelCB() |
| 661 | |
| 662 | time.AfterFunc(100*time.Millisecond, func() { |
| 663 | cancelCB() |
| 664 | }) |
| 665 | |
| 666 | nc.Close() |
| 667 | _, err := nc.RequestWithContext(ctx, "foo", []byte("")) |
| 668 | if err == nil { |
| 669 | t.Fatal("Expected request to fail with error") |
| 670 | } |
| 671 | if err != nats.ErrConnectionClosed { |
| 672 | t.Errorf("Expected request to fail with connection closed error: %s", err) |
| 673 | } |
| 674 | } |
| 675 | |
| 676 | func TestContextBadSubscription(t *testing.T) { |
| 677 | s := RunDefaultServer() |
nothing calls this directly
no test coverage detected