MCPcopy Create free account
hub / github.com/bytebase/bytebase / TestGetSchema_AmbiguousDatabase

Function TestGetSchema_AmbiguousDatabase

backend/api/mcp/tool_schema_test.go:677–692  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

675}
676
677func TestGetSchema_AmbiguousDatabase(t *testing.T) {
678 databases := []map[string]any{
679 makeDatabase("instances/prod-pg/databases/employee_db", "instances/prod-pg", "projects/hr-system", "POSTGRES", "ds-admin-1"),
680 makeDatabase("instances/staging-mysql/databases/employee_db", "instances/staging-mysql", "projects/hr-system", "MYSQL", "ds-admin-2"),
681 }
682 s := newTestServerWithMock(t, mockListDatabases(databases))
683
684 result, _, err := s.handleGetSchema(testContext(), nil, SchemaInput{
685 Database: "employee_db",
686 })
687 require.NoError(t, err)
688 require.True(t, result.IsError)
689
690 text := result.Content[0].(*mcpsdk.TextContent).Text
691 require.Contains(t, text, "AMBIGUOUS_TARGET")
692}
693
694func TestGetSchema_SchemaSyncFailed(t *testing.T) {
695 handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {

Callers

nothing calls this directly

Calls 5

newTestServerWithMockFunction · 0.85
mockListDatabasesFunction · 0.85
testContextFunction · 0.85
handleGetSchemaMethod · 0.80
makeDatabaseFunction · 0.70

Tested by

no test coverage detected