Skip to content

Commit 12ce7d8

Browse files
saucowclaude
andcommitted
fix: update tests for community server registration visibility
Tests previously asserted community servers were skipped for Desktop registration when the flag was ON. Now that registration is for OAuth tab visibility (not lifecycle ownership), tests expect registration to happen for both catalog and community servers. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 29de7ab commit 12ce7d8

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

cmd/docker-mcp/server/enable_oauth_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,9 @@ func TestEnable_OAuthServer_DesktopCommunityFlagOn(t *testing.T) {
144144
}
145145

146146
// TestEnable_DynamicDiscovery_GatewayOwns verifies that a community remote
147-
// server without explicit OAuth does not trigger dynamic discovery when
148-
// Gateway owns OAuth.
147+
// server without explicit OAuth still triggers dynamic discovery when Gateway
148+
// owns OAuth. Registration is for OAuth tab visibility — Gateway still owns
149+
// the authorize/revoke lifecycle.
149150
func TestEnable_DynamicDiscovery_GatewayOwns(t *testing.T) {
150151
ctx, _, docker, dockerCli := setup(t,
151152
withEmptyRegistryYaml(),
@@ -158,8 +159,8 @@ func TestEnable_DynamicDiscovery_GatewayOwns(t *testing.T) {
158159
err := Enable(ctx, docker, dockerCli, []string{"community-remote"}, true)
159160
require.NoError(t, err)
160161

161-
assert.Empty(t, *discoveryCalls,
162-
"Gateway-owned OAuth should not trigger dynamic discovery")
162+
assert.Equal(t, []string{"community-remote"}, *discoveryCalls,
163+
"Gateway-owned OAuth should still trigger dynamic discovery for OAuth tab visibility")
163164
}
164165

165166
// Verify the function pointers are wired to the real functions by default.

pkg/workingset/oauth_mixed_mode_test.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ func TestRegisterOAuthProviders_MixedCatalogAndCommunity_FlagOn(t *testing.T) {
9494

9595
RegisterOAuthProvidersForServers(context.Background(), servers)
9696

97-
assert.Equal(t, []string{"catalog-oauth"}, registeredServers,
98-
"flag ON: only catalog server should be registered with Desktop")
97+
assert.Equal(t, []string{"catalog-oauth", "community-oauth"}, registeredServers,
98+
"flag ON: both catalog and community servers should be registered with Desktop for OAuth tab visibility")
9999
}
100100

101101
// TestRegisterOAuthProviders_MixedCatalogAndCommunity_FlagOff verifies that
@@ -145,8 +145,9 @@ func newCommunityRemoteServer(name, url string) Server {
145145
}
146146

147147
// TestRegisterOAuthProviders_CommunityDynamicDiscovery_FlagOn verifies that
148-
// community servers with a URL but no explicit OAuth are NOT registered for
149-
// dynamic discovery when the McpGatewayOAuth flag is ON (Gateway owns OAuth).
148+
// community servers with a URL but no explicit OAuth ARE registered for
149+
// dynamic discovery when the McpGatewayOAuth flag is ON. Registration is for
150+
// OAuth tab visibility — Gateway still owns the authorize/revoke lifecycle.
150151
func TestRegisterOAuthProviders_CommunityDynamicDiscovery_FlagOn(t *testing.T) {
151152
mockDesktopModeWithGatewayOAuth(t, true)
152153

@@ -165,8 +166,8 @@ func TestRegisterOAuthProviders_CommunityDynamicDiscovery_FlagOn(t *testing.T) {
165166

166167
RegisterOAuthProvidersForServers(context.Background(), servers)
167168

168-
assert.Empty(t, discoveredServers,
169-
"flag ON: community remote server should NOT trigger dynamic discovery (Gateway owns OAuth)")
169+
assert.Equal(t, []string{"community-remote"}, discoveredServers,
170+
"flag ON: community remote server should trigger dynamic discovery for OAuth tab visibility")
170171
}
171172

172173
// TestRegisterOAuthProviders_CommunityDynamicDiscovery_FlagOff verifies that

0 commit comments

Comments
 (0)