🌐 AI搜索 & 代理 主页
Skip to content

Commit e10ff3e

Browse files
committed
Update tests.
1 parent 4938a50 commit e10ff3e

File tree

1 file changed

+35
-8
lines changed

1 file changed

+35
-8
lines changed

pkg/github/issues_test.go

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import (
1414
"github.com/github/github-mcp-server/internal/githubv4mock"
1515
"github.com/github/github-mcp-server/internal/toolsnaps"
1616
"github.com/github/github-mcp-server/pkg/lockdown"
17+
ghMcpObsv "github.com/github/github-mcp-server/pkg/observability"
18+
ghMcpLogger "github.com/github/github-mcp-server/pkg/observability/log"
1719
"github.com/github/github-mcp-server/pkg/translations"
1820
"github.com/google/go-github/v79/github"
1921
"github.com/google/jsonschema-go/jsonschema"
@@ -124,7 +126,9 @@ func Test_GetIssue(t *testing.T) {
124126
// Verify tool definition once
125127
mockClient := github.NewClient(nil)
126128
defaultGQLClient := githubv4.NewClient(nil)
127-
tool, _ := IssueRead(stubGetClientFn(mockClient), stubGetGQLClientFn(defaultGQLClient), repoAccessCache, translations.NullTranslationHelper, stubFeatureFlags(map[string]bool{"lockdown-mode": false}))
129+
nilLogger := ghMcpLogger.NewNoopLogger()
130+
obsv := ghMcpObsv.NewExporters(nilLogger)
131+
tool, _ := IssueRead(stubGetClientFn(mockClient), stubGetGQLClientFn(defaultGQLClient), repoAccessCache, translations.NullTranslationHelper, stubFeatureFlags(map[string]bool{"lockdown-mode": false}), obsv)
128132
require.NoError(t, toolsnaps.Test(tool.Name, tool))
129133

130134
assert.Equal(t, "issue_read", tool.Name)
@@ -331,7 +335,7 @@ func Test_GetIssue(t *testing.T) {
331335
}
332336

333337
flags := stubFeatureFlags(map[string]bool{"lockdown-mode": tc.lockdownEnabled})
334-
_, handler := IssueRead(stubGetClientFn(client), stubGetGQLClientFn(gqlClient), cache, translations.NullTranslationHelper, flags)
338+
_, handler := IssueRead(stubGetClientFn(client), stubGetGQLClientFn(gqlClient), cache, translations.NullTranslationHelper, flags, obsv)
335339

336340
request := createMCPRequest(tc.requestArgs)
337341
result, _, err := handler(context.Background(), &request, tc.requestArgs)
@@ -1833,7 +1837,11 @@ func Test_GetIssueComments(t *testing.T) {
18331837
// Verify tool definition once
18341838
mockClient := github.NewClient(nil)
18351839
gqlClient := githubv4.NewClient(nil)
1836-
tool, _ := IssueRead(stubGetClientFn(mockClient), stubGetGQLClientFn(gqlClient), stubRepoAccessCache(gqlClient, 15*time.Minute), translations.NullTranslationHelper, stubFeatureFlags(map[string]bool{"lockdown-mode": false}))
1840+
1841+
nilLogger := ghMcpLogger.NewNoopLogger()
1842+
obsv := ghMcpObsv.NewExporters(nilLogger)
1843+
1844+
tool, _ := IssueRead(stubGetClientFn(mockClient), stubGetGQLClientFn(gqlClient), stubRepoAccessCache(gqlClient, 15*time.Minute), translations.NullTranslationHelper, stubFeatureFlags(map[string]bool{"lockdown-mode": false}), obsv)
18371845
require.NoError(t, toolsnaps.Test(tool.Name, tool))
18381846

18391847
assert.Equal(t, "issue_read", tool.Name)
@@ -1984,7 +1992,10 @@ func Test_GetIssueComments(t *testing.T) {
19841992
}
19851993
cache := stubRepoAccessCache(gqlClient, 15*time.Minute)
19861994
flags := stubFeatureFlags(map[string]bool{"lockdown-mode": tc.lockdownEnabled})
1987-
_, handler := IssueRead(stubGetClientFn(client), stubGetGQLClientFn(gqlClient), cache, translations.NullTranslationHelper, flags)
1995+
nilLogger := ghMcpLogger.NewNoopLogger()
1996+
obsv := ghMcpObsv.NewExporters(nilLogger)
1997+
1998+
_, handler := IssueRead(stubGetClientFn(client), stubGetGQLClientFn(gqlClient), cache, translations.NullTranslationHelper, flags, obsv)
19881999

19892000
// Create call request
19902001
request := createMCPRequest(tc.requestArgs)
@@ -2024,7 +2035,11 @@ func Test_GetIssueLabels(t *testing.T) {
20242035
// Verify tool definition
20252036
mockGQClient := githubv4.NewClient(nil)
20262037
mockClient := github.NewClient(nil)
2027-
tool, _ := IssueRead(stubGetClientFn(mockClient), stubGetGQLClientFn(mockGQClient), stubRepoAccessCache(mockGQClient, 15*time.Minute), translations.NullTranslationHelper, stubFeatureFlags(map[string]bool{"lockdown-mode": false}))
2038+
2039+
nilLogger := ghMcpLogger.NewNoopLogger()
2040+
obsv := ghMcpObsv.NewExporters(nilLogger)
2041+
2042+
tool, _ := IssueRead(stubGetClientFn(mockClient), stubGetGQLClientFn(mockGQClient), stubRepoAccessCache(mockGQClient, 15*time.Minute), translations.NullTranslationHelper, stubFeatureFlags(map[string]bool{"lockdown-mode": false}), obsv)
20282043
require.NoError(t, toolsnaps.Test(tool.Name, tool))
20292044

20302045
assert.Equal(t, "issue_read", tool.Name)
@@ -2099,7 +2114,11 @@ func Test_GetIssueLabels(t *testing.T) {
20992114
t.Run(tc.name, func(t *testing.T) {
21002115
gqlClient := githubv4.NewClient(tc.mockedClient)
21012116
client := github.NewClient(nil)
2102-
_, handler := IssueRead(stubGetClientFn(client), stubGetGQLClientFn(gqlClient), stubRepoAccessCache(gqlClient, 15*time.Minute), translations.NullTranslationHelper, stubFeatureFlags(map[string]bool{"lockdown-mode": false}))
2117+
2118+
nilLogger := ghMcpLogger.NewNoopLogger()
2119+
obsv := ghMcpObsv.NewExporters(nilLogger)
2120+
2121+
_, handler := IssueRead(stubGetClientFn(client), stubGetGQLClientFn(gqlClient), stubRepoAccessCache(gqlClient, 15*time.Minute), translations.NullTranslationHelper, stubFeatureFlags(map[string]bool{"lockdown-mode": false}), obsv)
21032122

21042123
request := createMCPRequest(tc.requestArgs)
21052124
result, _, err := handler(context.Background(), &request, tc.requestArgs)
@@ -2790,7 +2809,11 @@ func Test_GetSubIssues(t *testing.T) {
27902809
// Verify tool definition once
27912810
mockClient := github.NewClient(nil)
27922811
gqlClient := githubv4.NewClient(nil)
2793-
tool, _ := IssueRead(stubGetClientFn(mockClient), stubGetGQLClientFn(gqlClient), stubRepoAccessCache(gqlClient, 15*time.Minute), translations.NullTranslationHelper, stubFeatureFlags(map[string]bool{"lockdown-mode": false}))
2812+
2813+
nilLogger := ghMcpLogger.NewNoopLogger()
2814+
obsv := ghMcpObsv.NewExporters(nilLogger)
2815+
2816+
tool, _ := IssueRead(stubGetClientFn(mockClient), stubGetGQLClientFn(gqlClient), stubRepoAccessCache(gqlClient, 15*time.Minute), translations.NullTranslationHelper, stubFeatureFlags(map[string]bool{"lockdown-mode": false}), obsv)
27942817
require.NoError(t, toolsnaps.Test(tool.Name, tool))
27952818

27962819
assert.Equal(t, "issue_read", tool.Name)
@@ -2987,7 +3010,11 @@ func Test_GetSubIssues(t *testing.T) {
29873010
// Setup client with mock
29883011
client := github.NewClient(tc.mockedClient)
29893012
gqlClient := githubv4.NewClient(nil)
2990-
_, handler := IssueRead(stubGetClientFn(client), stubGetGQLClientFn(gqlClient), stubRepoAccessCache(gqlClient, 15*time.Minute), translations.NullTranslationHelper, stubFeatureFlags(map[string]bool{"lockdown-mode": false}))
3013+
3014+
nilLogger := ghMcpLogger.NewNoopLogger()
3015+
obsv := ghMcpObsv.NewExporters(nilLogger)
3016+
3017+
_, handler := IssueRead(stubGetClientFn(client), stubGetGQLClientFn(gqlClient), stubRepoAccessCache(gqlClient, 15*time.Minute), translations.NullTranslationHelper, stubFeatureFlags(map[string]bool{"lockdown-mode": false}), obsv)
29913018

29923019
// Create call request
29933020
request := createMCPRequest(tc.requestArgs)

0 commit comments

Comments
 (0)