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

Commit4e26dce

Browse files
committed
Support e2e test parallelisation
1 parentf9427ab commit4e26dce

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

‎e2e/e2e_test.go

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package e2e_test
55
import (
66
"context"
77
"encoding/json"
8+
"fmt"
89
"os"
910
"os/exec"
1011
"slices"
@@ -88,20 +89,14 @@ func setupMCPClient(t *testing.T, options ...ClientOption) *mcpClient.Client {
8889
option(opts)
8990
}
9091

91-
// Set the GitHub token and other environment variables
92-
t.Setenv("GITHUB_PERSONAL_ACCESS_TOKEN",token)
93-
forkey,value:=rangeopts.EnvVars {
94-
t.Setenv(key,value)
95-
}
96-
9792
// Prepare Docker arguments
9893
args:= []string{
9994
"docker",
10095
"run",
10196
"-i",
10297
"--rm",
10398
"-e",
104-
"GITHUB_PERSONAL_ACCESS_TOKEN",
99+
"GITHUB_PERSONAL_ACCESS_TOKEN",// Personal access token is all required
105100
}
106101

107102
// Add all environment variables to the Docker arguments
@@ -112,9 +107,16 @@ func setupMCPClient(t *testing.T, options ...ClientOption) *mcpClient.Client {
112107
// Add the image name
113108
args=append(args,"github/e2e-github-mcp-server")
114109

110+
// Construct the env vars for the MCP Client to execute docker with
111+
dockerEnvVars:=make([]string,0,len(opts.EnvVars)+1)
112+
dockerEnvVars=append(dockerEnvVars,fmt.Sprintf("GITHUB_PERSONAL_ACCESS_TOKEN=%s",token))
113+
forkey,value:=rangeopts.EnvVars {
114+
dockerEnvVars=append(dockerEnvVars,fmt.Sprintf("%s=%s",key,value))
115+
}
116+
115117
// Create the client
116118
t.Log("Starting Stdio MCP client...")
117-
client,err:=mcpClient.NewStdioMCPClient(args[0],[]string{},args[1:]...)
119+
client,err:=mcpClient.NewStdioMCPClient(args[0],dockerEnvVars,args[1:]...)
118120
require.NoError(t,err,"expected to create client successfully")
119121
t.Cleanup(func() {
120122
require.NoError(t,client.Close(),"expected to close client successfully")
@@ -139,6 +141,8 @@ func setupMCPClient(t *testing.T, options ...ClientOption) *mcpClient.Client {
139141
}
140142

141143
funcTestGetMe(t*testing.T) {
144+
t.Parallel()
145+
142146
mcpClient:=setupMCPClient(t)
143147

144148
ctx,cancel:=context.WithTimeout(context.Background(),5*time.Second)
@@ -173,6 +177,8 @@ func TestGetMe(t *testing.T) {
173177
}
174178

175179
funcTestToolsets(t*testing.T) {
180+
t.Parallel()
181+
176182
mcpClient:=setupMCPClient(
177183
t,
178184
WithEnvVars(map[string]string{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp