(t *testing.T)
| 28 | } |
| 29 | |
| 30 | func TestResolve_ProjectInAmbiguous(t *testing.T) { |
| 31 | databases := []databaseEntry{ |
| 32 | { |
| 33 | Name: "instances/prod-pg/databases/app", |
| 34 | Project: "projects/payments", |
| 35 | InstanceResource: instanceResource{ |
| 36 | Name: "instances/prod-pg", |
| 37 | Engine: "POSTGRES", |
| 38 | DataSources: []dataSource{{ID: "ds-1", Type: "ADMIN"}}, |
| 39 | }, |
| 40 | }, |
| 41 | { |
| 42 | Name: "instances/staging-pg/databases/app", |
| 43 | Project: "projects/staging", |
| 44 | InstanceResource: instanceResource{ |
| 45 | Name: "instances/staging-pg", |
| 46 | Engine: "POSTGRES", |
| 47 | DataSources: []dataSource{{ID: "ds-2", Type: "ADMIN"}}, |
| 48 | }, |
| 49 | }, |
| 50 | } |
| 51 | |
| 52 | resolved, err := matchDatabases(databases, "app", "", "") |
| 53 | require.NoError(t, err) |
| 54 | require.True(t, resolved.ambiguous) |
| 55 | require.Len(t, resolved.candidates, 2) |
| 56 | require.Equal(t, "projects/payments", resolved.projects["instances/prod-pg/databases/app"]) |
| 57 | require.Equal(t, "projects/staging", resolved.projects["instances/staging-pg/databases/app"]) |
| 58 | } |
nothing calls this directly
no test coverage detected