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

Function TestQueryDatabase_SingleMatch

backend/api/mcp/tool_query_test.go:223–235  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

221}
222
223func TestQueryDatabase_SingleMatch(t *testing.T) {
224 databases := []map[string]any{
225 makeDatabase("instances/prod-pg/databases/employee_db", "instances/prod-pg", "projects/hr-system", "POSTGRES", "ds-admin-1"),
226 makeDatabase("instances/prod-pg/databases/orders_db", "instances/prod-pg", "projects/commerce", "POSTGRES", "ds-admin-2"),
227 }
228 s := newTestServerWithMock(t, mockListDatabases(databases))
229
230 resolved, err := s.resolveDatabase(testContext(), "employee_db", "", "")
231 require.NoError(t, err)
232 require.False(t, resolved.ambiguous)
233 require.Equal(t, "instances/prod-pg/databases/employee_db", resolved.resourceName)
234 require.Equal(t, "ds-admin-1", resolved.dataSourceID)
235}
236
237func TestQueryDatabase_CaseInsensitiveMatch(t *testing.T) {
238 databases := []map[string]any{

Callers

nothing calls this directly

Calls 6

newTestServerWithMockFunction · 0.85
mockListDatabasesFunction · 0.85
testContextFunction · 0.85
resolveDatabaseMethod · 0.80
makeDatabaseFunction · 0.70
EqualMethod · 0.65

Tested by

no test coverage detected