From 661d6a551ea93106a314ef830f940bf137379404 Mon Sep 17 00:00:00 2001 From: Michael Gaffney Date: Tue, 14 Jun 2022 12:36:07 -0400 Subject: [PATCH] test(tcp): only host sets from the same project can be added to a target --- internal/target/tcp/repository_host_source_test.go | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/internal/target/tcp/repository_host_source_test.go b/internal/target/tcp/repository_host_source_test.go index 0c6c922a3..8767820fd 100644 --- a/internal/target/tcp/repository_host_source_test.go +++ b/internal/target/tcp/repository_host_source_test.go @@ -33,17 +33,12 @@ func TestRepository_AddTargetHostSets(t *testing.T) { wrapper := db.TestWrapper(t) testKms := kms.TestKms(t, conn, wrapper) iamRepo := iam.TestRepo(t, conn, wrapper) - staticOrg, staticProj := iam.TestScopes(t, iamRepo) + _, staticProj := iam.TestScopes(t, iamRepo) repo, err := target.NewRepository(rw, rw, testKms) require.NoError(t, err) - createHostSetsFn := func(orgs, projects []string) []string { + createHostSetsFn := func(projects []string) []string { results := []string{} - for _, publicId := range orgs { - cats := static.TestCatalogs(t, conn, publicId, 1) - hsets := static.TestSets(t, conn, cats[0].GetPublicId(), 1) - results = append(results, hsets[0].PublicId) - } for _, publicId := range projects { cats := static.TestCatalogs(t, conn, publicId, 1) hsets := static.TestSets(t, conn, cats[0].GetPublicId(), 1) @@ -110,7 +105,7 @@ func TestRepository_AddTargetHostSets(t *testing.T) { require.Equal(0, len(origHostSet)) if tt.args.wantTargetIds { - hostSourceIds = createHostSetsFn([]string{staticOrg.PublicId}, []string{staticProj.PublicId}) + hostSourceIds = createHostSetsFn([]string{staticProj.PublicId}) } gotTarget, gotHostSources, _, err := repo.AddTargetHostSources(ctx, projTarget.GetPublicId(), tt.args.targetVersion, hostSourceIds, tt.args.opt...)