Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite0dd50d

Browse files
authored
chore(cli): fix test flake in TestExpMcpServer (#17772)
Test was failing inside a Coder workspace.
1 parentea2cae0 commite0dd50d

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

‎cli/exp_mcp_test.go

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -133,26 +133,29 @@ func TestExpMcpServer(t *testing.T) {
133133
require.Equal(t,1.0,initializeResponse["id"])
134134
require.NotNil(t,initializeResponse["result"])
135135
})
136+
}
136137

137-
t.Run("NoCredentials",func(t*testing.T) {
138-
t.Parallel()
138+
funcTestExpMcpServerNoCredentials(t*testing.T) {
139+
// Ensure that no credentials are set from the environment.
140+
t.Setenv("CODER_AGENT_TOKEN","")
141+
t.Setenv("CODER_AGENT_TOKEN_FILE","")
142+
t.Setenv("CODER_SESSION_TOKEN","")
139143

140-
ctx:=testutil.Context(t,testutil.WaitShort)
141-
cancelCtx,cancel:=context.WithCancel(ctx)
142-
t.Cleanup(cancel)
144+
ctx:=testutil.Context(t,testutil.WaitShort)
145+
cancelCtx,cancel:=context.WithCancel(ctx)
146+
t.Cleanup(cancel)
143147

144-
client:=coderdtest.New(t,nil)
145-
inv,root:=clitest.New(t,"exp","mcp","server")
146-
inv=inv.WithContext(cancelCtx)
148+
client:=coderdtest.New(t,nil)
149+
inv,root:=clitest.New(t,"exp","mcp","server")
150+
inv=inv.WithContext(cancelCtx)
147151

148-
pty:=ptytest.New(t)
149-
inv.Stdin=pty.Input()
150-
inv.Stdout=pty.Output()
151-
clitest.SetupConfig(t,client,root)
152+
pty:=ptytest.New(t)
153+
inv.Stdin=pty.Input()
154+
inv.Stdout=pty.Output()
155+
clitest.SetupConfig(t,client,root)
152156

153-
err:=inv.Run()
154-
assert.ErrorContains(t,err,"are not logged in")
155-
})
157+
err:=inv.Run()
158+
assert.ErrorContains(t,err,"are not logged in")
156159
}
157160

158161
//nolint:tparallel,paralleltest

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp