diff --git a/internal/iam/repository_scope.go b/internal/iam/repository_scope.go index dd66c6f32f..af4198c0f4 100644 --- a/internal/iam/repository_scope.go +++ b/internal/iam/repository_scope.go @@ -134,7 +134,7 @@ func (r *Repository) ListProjects(ctx context.Context, withOrganizationId string return projects, nil } -// ListOrganizations organizations and supports the WithLimit option. +// ListOrganizations and supports the WithLimit option. func (r *Repository) ListOrganizations(ctx context.Context, opt ...Option) ([]*Scope, error) { var projects []*Scope err := r.list(ctx, &projects, "type = ?", []interface{}{OrganizationScope.String()}, opt...) diff --git a/internal/iam/repository_scope_test.go b/internal/iam/repository_scope_test.go index 716b1bf2c6..51d6fced29 100644 --- a/internal/iam/repository_scope_test.go +++ b/internal/iam/repository_scope_test.go @@ -563,6 +563,7 @@ func TestRepository_ListProjects(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { assert, require := assert.New(t), require.New(t) + require.NoError(conn.Where("public_id != ?", org.PublicId).Delete(allocScope()).Error) testProjects := []*Scope{} for i := 0; i < tt.createCnt; i++ { testProjects = append(testProjects, testProject(t, conn, org.PublicId)) @@ -632,6 +633,7 @@ func TestRepository_ListOrganizations(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { assert, require := assert.New(t), require.New(t) + require.NoError(conn.Where("1=1").Delete(allocScope()).Error) testOrgs := []*Scope{} for i := 0; i < tt.createCnt; i++ { testOrgs = append(testOrgs, testOrg(t, conn, "", ""))