Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v16] Deflake TestAWSOIDCRequiredVPCSHelper_CombinedSubnetsForAVpcID #50938

Merged
merged 1 commit into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/web/integrations_awsoidc.go
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,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 {
Expand Down
11 changes: 8 additions & 3 deletions lib/web/integrations_awsoidc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -963,8 +963,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",
Expand All @@ -983,13 +981,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",
Expand Down
Loading