chore: use integration package for name generation (#10591)

# Which Problems Are Solved

Integration test failed sometimes with `organization already
exists`-errors.

# How the Problems Are Solved

Use a consistent function to generate name used for organization
creation.

# Additional Changes

Correct a eventual consistent test for username around organization
domain changes with eventual consistent loop.

# Additional Context

None

---------

Co-authored-by: Livio Spring <[email protected]>
This commit is contained in:
Stefan Benz
2025-08-29 14:56:16 +02:00
committed by GitHub
co-authored by Livio Spring
parent 832e78f9bc
commit 5721b63bcb
21 changed files with 114 additions and 115 deletions
@@ -106,7 +106,7 @@ func TestServer_ListOrganizations(t *testing.T) {
func(ctx context.Context, request *org.ListOrganizationsRequest) ([]orgAttr, error) {
count := 3
orgs := make([]orgAttr, count)
prefix := fmt.Sprintf("ListOrgs-%s", gofakeit.AppName())
prefix := integration.OrganizationName()
for i := 0; i < count; i++ {
name := prefix + strconv.Itoa(i)
orgs[i] = createOrganization(ctx, name)
@@ -275,8 +275,7 @@ func TestServer_ListOrganizations(t *testing.T) {
&org.ListOrganizationsRequest{},
func(ctx context.Context, request *org.ListOrganizationsRequest) ([]orgAttr, error) {
orgs := make([]orgAttr, 1)
name := fmt.Sprintf("ListOrgs-%s", gofakeit.AppName())
orgs[0] = createOrganization(ctx, name)
orgs[0] = createOrganization(ctx, integration.OrganizationName())
domain := gofakeit.DomainName()
_, err := Instance.Client.Mgmt.AddOrgDomain(integration.SetOrgID(ctx, orgs[0].ID), &management.AddOrgDomainRequest{
Domain: domain,
@@ -311,7 +310,7 @@ func TestServer_ListOrganizations(t *testing.T) {
Queries: []*org.SearchQuery{},
},
func(ctx context.Context, request *org.ListOrganizationsRequest) ([]orgAttr, error) {
name := gofakeit.Name()
name := integration.OrganizationName()
orgResp := createOrganization(ctx, name)
deactivateOrgResp := Instance.DeactivateOrganization(ctx, orgResp.ID)
request.Queries = []*org.SearchQuery{