(t *testing.T)
| 828 | } |
| 829 | |
| 830 | func TestClassifyError(t *testing.T) { |
| 831 | t.Parallel() |
| 832 | |
| 833 | tests := []struct { |
| 834 | name string |
| 835 | err error |
| 836 | want chatdebug.Status |
| 837 | }{ |
| 838 | {"nil", nil, chatdebug.StatusCompleted}, |
| 839 | {"context.Canceled", context.Canceled, chatdebug.StatusInterrupted}, |
| 840 | // Wrapped context.Canceled must still classify as interrupted so |
| 841 | // callers that decorate cancellation errors do not flip to |
| 842 | // StatusError. |
| 843 | { |
| 844 | "wrapped context.Canceled", |
| 845 | xerrors.Errorf("canceled mid-stream: %w", context.Canceled), |
| 846 | chatdebug.StatusInterrupted, |
| 847 | }, |
| 848 | {"generic error", xerrors.New("boom"), chatdebug.StatusError}, |
| 849 | // context.DeadlineExceeded is not context.Canceled and is not |
| 850 | // special-cased by ClassifyError, so it must fall through to |
| 851 | // StatusError. This pins the priority ordering in the switch. |
| 852 | { |
| 853 | "context.DeadlineExceeded", |
| 854 | context.DeadlineExceeded, chatdebug.StatusError, |
| 855 | }, |
| 856 | } |
| 857 | for _, tt := range tests { |
| 858 | t.Run(tt.name, func(t *testing.T) { |
| 859 | t.Parallel() |
| 860 | require.Equal(t, tt.want, chatdebug.ClassifyError(tt.err)) |
| 861 | }) |
| 862 | } |
| 863 | } |
| 864 | |
| 865 | func TestService_FinalizeRun_FallsBackToSeedSummary(t *testing.T) { |
| 866 | t.Parallel() |
nothing calls this directly
no test coverage detected