MCPcopy Index your code
hub / github.com/coder/coder / TestTerminalMessage

Function TestTerminalMessage

coderd/x/chatd/chaterror/message_test.go:17–121  ·  view source on GitHub ↗

TestTerminalMessage covers the per-provider "temporarily unavailable" copy, the startup-timeout copy, and the generic fallback string for its intended (unclassified, non-retryable) path.

(t *testing.T)

Source from the content-addressed store, hash-verified

15// fallback string for its intended (unclassified, non-retryable)
16// path.
17func TestTerminalMessage(t *testing.T) {
18 t.Parallel()
19
20 tests := []struct {
21 name string
22 kind codersdk.ChatErrorKind
23 provider string
24 retryable bool
25 statusCode int
26 want string
27 }{
28 {
29 name: "Timeout_Retryable_Anthropic",
30 kind: codersdk.ChatErrorKindTimeout,
31 provider: "anthropic",
32 retryable: true,
33 want: "Anthropic is temporarily unavailable.",
34 },
35 {
36 name: "Timeout_Retryable_OpenAI",
37 kind: codersdk.ChatErrorKindTimeout,
38 provider: "openai",
39 retryable: true,
40 want: "OpenAI is temporarily unavailable.",
41 },
42 {
43 name: "Timeout_Retryable_UnknownProvider",
44 kind: codersdk.ChatErrorKindTimeout,
45 provider: "",
46 retryable: true,
47 want: "The AI provider is temporarily unavailable.",
48 },
49 {
50 name: "Timeout_NotRetryable_NoStatus",
51 kind: codersdk.ChatErrorKindTimeout,
52 provider: "",
53 retryable: false,
54 want: "The request timed out before it completed.",
55 },
56 {
57 name: "StartupTimeout_Anthropic",
58 kind: codersdk.ChatErrorKindStartupTimeout,
59 provider: "anthropic",
60 retryable: true,
61 want: "Anthropic did not start responding in time.",
62 },
63 {
64 name: "StartupTimeout_OpenAI",
65 kind: codersdk.ChatErrorKindStartupTimeout,
66 provider: "openai",
67 retryable: true,
68 want: "OpenAI did not start responding in time.",
69 },
70 {
71 // Generic fallback reserved for genuinely
72 // unclassified non-retryable failures.
73 name: "Generic_NotRetryable_NoStatus",
74 kind: codersdk.ChatErrorKindGeneric,

Callers

nothing calls this directly

Calls 5

WithClassificationFunction · 0.92
ClassifyFunction · 0.92
RunMethod · 0.65
NewMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected