TestChatUnreachable: transport failure surfaces as ErrUnreachable.
(t *testing.T)
| 507 | |
| 508 | // TestChatUnreachable: transport failure surfaces as ErrUnreachable. Retries |
| 509 | // off: this test pins the terminal error surface, not the retry path. |
| 510 | func TestChatUnreachable(t *testing.T) { |
| 511 | c := New("http://127.0.0.1:1", "m", "") |
| 512 | c.RetryBackoff = nil |
| 513 | evs := collect(c.Chat(context.Background(), nil, nil)) |
| 514 | if len(evs) != 1 { |
| 515 | t.Fatalf("want single event, got %d", len(evs)) |
| 516 | } |
| 517 | var un cloud.ErrUnreachable |
| 518 | if !errors.As(evs[0].Err, &un) { |
| 519 | t.Fatalf("want ErrUnreachable, got %v", evs[0].Err) |
| 520 | } |
| 521 | } |
| 522 |