diff --git a/lib/web/integrations_awsoidc.go b/lib/web/integrations_awsoidc.go index 0736ecba65702..47722e57d43ae 100644 --- a/lib/web/integrations_awsoidc.go +++ b/lib/web/integrations_awsoidc.go @@ -1055,7 +1055,7 @@ func awsOIDCListAllDatabases(ctx context.Context, clt authclient.ClientI, integr return fetchedRDSs, nil } -func awsOIDCRequiredVPCSHelper(ctx context.Context, clt authclient.ClientI, req ui.AWSOIDCRequiredVPCSRequest, fetchedRDSs []*types.DatabaseV3) (*ui.AWSOIDCRequiredVPCSResponse, error) { +func awsOIDCRequiredVPCSHelper(ctx context.Context, clt client.GetResourcesClient, req ui.AWSOIDCRequiredVPCSRequest, fetchedRDSs []*types.DatabaseV3) (*ui.AWSOIDCRequiredVPCSResponse, error) { // Get all database services with ecs/fargate metadata label. fetchedDbSvcs, err := fetchAWSOIDCDatabaseServices(ctx, clt) if err != nil { diff --git a/lib/web/integrations_awsoidc_test.go b/lib/web/integrations_awsoidc_test.go index b8414570999dc..583c637866880 100644 --- a/lib/web/integrations_awsoidc_test.go +++ b/lib/web/integrations_awsoidc_test.go @@ -973,8 +973,6 @@ func TestAWSOIDCRequiredVPCSHelper(t *testing.T) { func TestAWSOIDCRequiredVPCSHelper_CombinedSubnetsForAVpcID(t *testing.T) { t.Parallel() ctx := context.Background() - env := newWebPack(t, 1) - clt := env.proxies[0].client rdsVPC1 := mustCreateRDS(t, types.RDS{ VPCID: "vpc-1", @@ -993,13 +991,20 @@ func TestAWSOIDCRequiredVPCSHelper_CombinedSubnetsForAVpcID(t *testing.T) { rdss := []*types.DatabaseV3{rdsVPC1, rdsVPC1a, rdsVPC2} - resp, err := awsOIDCRequiredVPCSHelper(ctx, clt, ui.AWSOIDCRequiredVPCSRequest{Region: "us-east-1"}, rdss) + resp, err := awsOIDCRequiredVPCSHelper(ctx, &mockGetResources{}, ui.AWSOIDCRequiredVPCSRequest{Region: "us-east-1"}, rdss) require.NoError(t, err) require.Len(t, resp.VPCMapOfSubnets, 2) require.ElementsMatch(t, []string{"subnet1", "subnet2", "subnet3", "subnet4"}, resp.VPCMapOfSubnets["vpc-1"]) require.ElementsMatch(t, []string{"subnet8"}, resp.VPCMapOfSubnets["vpc-2"]) } +type mockGetResources struct { +} + +func (m *mockGetResources) GetResources(ctx context.Context, req *proto.ListResourcesRequest) (*proto.ListResourcesResponse, error) { + return &proto.ListResourcesResponse{}, nil +} + func mustCreateRDS(t *testing.T, awsRDS types.RDS) *types.DatabaseV3 { rdsDB, err := types.NewDatabaseV3(types.Metadata{ Name: "x",