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

Function TestQueryDatabase_AdminFallback

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

Source from the content-addressed store, hash-verified

364}
365
366func TestQueryDatabase_AdminFallback(t *testing.T) {
367 databases := []map[string]any{
368 makeDatabase("instances/prod-pg/databases/employee_db", "instances/prod-pg", "projects/hr-system", "POSTGRES", "ds-admin-1"),
369 }
370 s := newTestServerWithMock(t, mockListDatabases(databases))
371
372 resolved, err := s.resolveDatabase(testContext(), "employee_db", "", "")
373 require.NoError(t, err)
374 require.False(t, resolved.ambiguous)
375 require.Equal(t, "ds-admin-1", resolved.dataSourceID)
376}
377
378func TestQueryDatabase_FormatAmbiguousResult(t *testing.T) {
379 candidates := []Candidate{

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