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

Function TestQueryDatabase_NotFound

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

Source from the content-addressed store, hash-verified

259}
260
261func TestQueryDatabase_NotFound(t *testing.T) {
262 databases := []map[string]any{
263 makeDatabase("instances/prod-pg/databases/employee_db", "instances/prod-pg", "projects/hr-system", "POSTGRES", "ds-admin-1"),
264 }
265 s := newTestServerWithMock(t, mockListDatabases(databases))
266
267 _, err := s.resolveDatabase(testContext(), "nonexistent", "", "")
268 require.Error(t, err)
269
270 var te *toolError
271 require.ErrorAs(t, err, &te)
272 require.Equal(t, "DATABASE_NOT_FOUND", te.Code)
273 require.Contains(t, te.Suggestion, "search_api")
274}
275
276func TestQueryDatabase_NotFoundWithFilters(t *testing.T) {
277 databases := []map[string]any{

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected