Skip to content

Commit 506c969

Browse files
committed
add test for agent troubleshooting url
1 parent 175206a commit 506c969

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

cli/cliui/agent_test.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,29 @@ func TestAgent(t *testing.T) {
272272
},
273273
wantErr: true,
274274
},
275+
{
276+
name: "Shows agent troubleshooting URL",
277+
opts: cliui.AgentOptions{
278+
FetchInterval: time.Millisecond,
279+
Wait: true,
280+
},
281+
iter: []func(context.Context, *codersdk.WorkspaceAgent, chan []codersdk.WorkspaceAgentStartupLog) error{
282+
func(_ context.Context, agent *codersdk.WorkspaceAgent, _ chan []codersdk.WorkspaceAgentStartupLog) error {
283+
agent.Status = codersdk.WorkspaceAgentTimeout
284+
agent.TroubleshootingURL = "https://troubleshoot"
285+
return nil
286+
},
287+
func(_ context.Context, agent *codersdk.WorkspaceAgent, _ chan []codersdk.WorkspaceAgentStartupLog) error {
288+
return xerrors.New("bad")
289+
},
290+
},
291+
want: []string{
292+
"⧗ Waiting for initial connection from the workspace agent",
293+
"The workspace agent is having trouble connecting, we will keep trying to reach it",
294+
"https://troubleshoot",
295+
},
296+
wantErr: true,
297+
},
275298
} {
276299
tc := tc
277300
t.Run(tc.name, func(t *testing.T) {

0 commit comments

Comments
 (0)