Skip to content

Commit 2995fb2

Browse files
added a test for the non-default path registration
Signed-off-by: malladi nagarjuna <zombmalladinags69@gmail.com>
1 parent b8dd4c2 commit 2995fb2

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

tests/e2e/happy_path_test.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,37 @@ var _ = Describe("MCP Gateway Registration Happy Path", func() {
169169
Expect(res.Content).NotTo(BeEmpty())
170170
})
171171

172+
It("[Happy] should register mcp server with non-default spec.path", func() {
173+
By("Registering an MCP server with a non-default path")
174+
registration := NewTestResources("non-default-path", k8sClient).
175+
ForInternalService("mcp-custom-path-server", 8080).
176+
WithPrefix("custompath_").
177+
WithPath("/v1/special/mcp").
178+
Build()
179+
testResources = append(testResources, registration.GetObjects()...)
180+
registeredServer := registration.Register(ctx)
181+
182+
By("Verifying MCPServerRegistration becomes ready")
183+
Eventually(func(g Gomega) {
184+
g.Expect(VerifyMCPServerRegistrationReady(ctx, k8sClient, registeredServer.Name, registeredServer.Namespace)).To(Succeed())
185+
}, TestTimeoutLong, TestRetryInterval).To(Succeed())
186+
187+
By("Verifying tools are accessible")
188+
Eventually(func(g Gomega) {
189+
toolsList, err := mcpGatewayClient.ListTools(ctx, mcp.ListToolsRequest{})
190+
g.Expect(err).NotTo(HaveOccurred())
191+
g.Expect(verifyMCPServerRegistrationToolsPresent("custompath_", toolsList)).To(BeTrue())
192+
}, TestTimeoutConfigSync, TestRetryInterval).To(Succeed())
193+
194+
By("Calling a tool to verify the broker connected via the non-default path")
195+
res, err := mcpGatewayClient.CallTool(ctx, mcp.CallToolRequest{
196+
Params: mcp.CallToolParams{Name: "custompath_path_info"},
197+
})
198+
Expect(err).NotTo(HaveOccurred())
199+
Expect(res).NotTo(BeNil())
200+
Expect(res.Content).NotTo(BeEmpty())
201+
})
202+
172203
It("[Happy] should register mcp server with credential with the gateway and make the tools available", func() {
173204
cred := BuildCredentialSecret("mcp-credential", "test-api-key-secret-toke")
174205
registration := NewMCPServerResourcesWithDefaults("credentials", k8sClient).

0 commit comments

Comments
 (0)