chore: move gofakeit integration testing calls (#10684)

# Which Problems Are Solved

Flakiness and conflicts in value from gofakeit.

# How the Problems Are Solved

Move Gofakeit calls to the integration package, to guarantee proper
usage and values for integration testing.

# Additional Changes

None

# Additional Context

None

(cherry picked from commit 492f1826ee)
This commit is contained in:
Stefan Benz
2025-09-10 08:00:31 +02:00
committed by Livio Spring
parent 78ded99017
commit b892fc9b28
70 changed files with 1404 additions and 1293 deletions

View File

@@ -8,7 +8,6 @@ import (
"testing"
"time"
"github.com/brianvoe/gofakeit/v6"
"github.com/muhlemmer/gu"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -108,7 +107,7 @@ func TestServer_AddOrganization(t *testing.T) {
FamilyName: "lastname",
},
Email: &user.SetHumanEmail{
Email: gofakeit.Email(),
Email: integration.Email(),
Verification: &user.SetHumanEmail_ReturnCode{
ReturnCode: &user.ReturnEmailVerificationCode{},
},
@@ -146,7 +145,7 @@ func TestServer_AddOrganization(t *testing.T) {
FamilyName: "lastname",
},
Email: &user.SetHumanEmail{
Email: gofakeit.Email(),
Email: integration.Email(),
Verification: &user.SetHumanEmail_IsVerified{
IsVerified: true,
},

View File

@@ -4,14 +4,12 @@ package org_test
import (
"context"
"fmt"
"slices"
"strconv"
"strings"
"testing"
"time"
"github.com/brianvoe/gofakeit/v6"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"google.golang.org/protobuf/types/known/timestamppb"
@@ -29,7 +27,7 @@ type orgAttr struct {
}
func createOrganization(ctx context.Context, name string) orgAttr {
orgResp := Instance.CreateOrganization(ctx, name, gofakeit.Email())
orgResp := Instance.CreateOrganization(ctx, name, integration.Email())
orgResp.Details.CreationDate = orgResp.Details.ChangeDate
return orgAttr{
ID: orgResp.GetOrganizationId(),
@@ -180,8 +178,8 @@ 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())
orgID := gofakeit.Company()
name := integration.OrganizationName()
orgID := integration.ID()
orgs[0] = createOrganizationWithCustomOrgID(ctx, name, orgID)
request.Queries = []*org.SearchQuery{
OrganizationIdQuery(orgID),
@@ -276,7 +274,7 @@ func TestServer_ListOrganizations(t *testing.T) {
func(ctx context.Context, request *org.ListOrganizationsRequest) ([]orgAttr, error) {
orgs := make([]orgAttr, 1)
orgs[0] = createOrganization(ctx, integration.OrganizationName())
domain := gofakeit.DomainName()
domain := integration.DomainName()
_, err := Instance.Client.Mgmt.AddOrgDomain(integration.SetOrgID(ctx, orgs[0].ID), &management.AddOrgDomainRequest{
Domain: domain,
})