(t *testing.T)
| 247 | } |
| 248 | |
| 249 | func TestQueryDatabase_SubstringMatch(t *testing.T) { |
| 250 | databases := []map[string]any{ |
| 251 | makeDatabase("instances/prod-pg/databases/employee_db", "instances/prod-pg", "projects/hr-system", "POSTGRES", "ds-admin-1"), |
| 252 | } |
| 253 | s := newTestServerWithMock(t, mockListDatabases(databases)) |
| 254 | |
| 255 | resolved, err := s.resolveDatabase(testContext(), "employee", "", "") |
| 256 | require.NoError(t, err) |
| 257 | require.False(t, resolved.ambiguous) |
| 258 | require.Equal(t, "instances/prod-pg/databases/employee_db", resolved.resourceName) |
| 259 | } |
| 260 | |
| 261 | func TestQueryDatabase_NotFound(t *testing.T) { |
| 262 | databases := []map[string]any{ |
nothing calls this directly
no test coverage detected