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

@@ -7,7 +7,6 @@ import (
"testing"
"time"
"github.com/brianvoe/gofakeit/v6"
"github.com/muhlemmer/gu"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -80,7 +79,7 @@ func TestServer_ListUserSchemas(t *testing.T) {
ctx: isolatedIAMOwnerCTX,
req: &schema.SearchUserSchemasRequest{},
prepare: func(request *schema.SearchUserSchemasRequest, resp *schema.SearchUserSchemasResponse) error {
schemaType := gofakeit.Name()
schemaType := integration.UserSchemaName()
createResp := instance.CreateUserSchemaEmptyWithType(isolatedIAMOwnerCTX, schemaType)
request.Filters = []*schema.SearchFilter{
{
@@ -126,7 +125,7 @@ func TestServer_ListUserSchemas(t *testing.T) {
ctx: isolatedIAMOwnerCTX,
req: &schema.SearchUserSchemasRequest{},
prepare: func(request *schema.SearchUserSchemasRequest, resp *schema.SearchUserSchemasResponse) error {
schemaType := gofakeit.Name()
schemaType := integration.UserSchemaName()
schemaType1 := schemaType + "_1"
schemaType2 := schemaType + "_2"
createResp := instance.CreateUserSchemaEmptyWithType(isolatedIAMOwnerCTX, schemaType1)
@@ -241,7 +240,7 @@ func TestServer_GetUserSchema(t *testing.T) {
ctx: instance.WithAuthorization(context.Background(), integration.UserTypeOrgOwner),
req: &schema.GetUserSchemaRequest{},
prepare: func(request *schema.GetUserSchemaRequest, resp *schema.GetUserSchemaResponse) error {
schemaType := gofakeit.Name()
schemaType := integration.UserSchemaName()
createResp := instance.CreateUserSchemaEmptyWithType(isolatedIAMOwnerCTX, schemaType)
request.Id = createResp.GetDetails().GetId()
return nil
@@ -265,7 +264,7 @@ func TestServer_GetUserSchema(t *testing.T) {
ctx: isolatedIAMOwnerCTX,
req: &schema.GetUserSchemaRequest{},
prepare: func(request *schema.GetUserSchemaRequest, resp *schema.GetUserSchemaResponse) error {
schemaType := gofakeit.Name()
schemaType := integration.UserSchemaName()
createResp := instance.CreateUserSchemaEmptyWithType(isolatedIAMOwnerCTX, schemaType)
request.Id = createResp.GetDetails().GetId()

View File

@@ -6,7 +6,6 @@ import (
"context"
"testing"
"github.com/brianvoe/gofakeit/v6"
"github.com/muhlemmer/gu"
"github.com/stretchr/testify/require"
"google.golang.org/protobuf/types/known/structpb"
@@ -35,7 +34,7 @@ func TestServer_CreateUserSchema(t *testing.T) {
ctx: instance.WithAuthorization(context.Background(), integration.UserTypeOrgOwner),
req: &schema.CreateUserSchemaRequest{
UserSchema: &schema.UserSchema{
Type: gofakeit.Name(),
Type: integration.Username(),
},
},
wantErr: true,
@@ -55,7 +54,7 @@ func TestServer_CreateUserSchema(t *testing.T) {
ctx: isolatedIAMOwnerCTX,
req: &schema.CreateUserSchemaRequest{
UserSchema: &schema.UserSchema{
Type: gofakeit.Name(),
Type: integration.UserSchemaName(),
},
},
wantErr: true,
@@ -65,7 +64,7 @@ func TestServer_CreateUserSchema(t *testing.T) {
ctx: isolatedIAMOwnerCTX,
req: &schema.CreateUserSchemaRequest{
UserSchema: &schema.UserSchema{
Type: gofakeit.Name(),
Type: integration.UserSchemaName(),
DataType: &schema.UserSchema_Schema{
Schema: func() *structpb.Struct {
s := new(structpb.Struct)
@@ -96,7 +95,7 @@ func TestServer_CreateUserSchema(t *testing.T) {
ctx: isolatedIAMOwnerCTX,
req: &schema.CreateUserSchemaRequest{
UserSchema: &schema.UserSchema{
Type: gofakeit.Name(),
Type: integration.UserSchemaName(),
DataType: &schema.UserSchema_Schema{
Schema: func() *structpb.Struct {
s := new(structpb.Struct)
@@ -135,7 +134,7 @@ func TestServer_CreateUserSchema(t *testing.T) {
ctx: isolatedIAMOwnerCTX,
req: &schema.CreateUserSchemaRequest{
UserSchema: &schema.UserSchema{
Type: gofakeit.Name(),
Type: integration.UserSchemaName(),
DataType: &schema.UserSchema_Schema{
Schema: func() *structpb.Struct {
s := new(structpb.Struct)
@@ -169,7 +168,7 @@ func TestServer_CreateUserSchema(t *testing.T) {
ctx: isolatedIAMOwnerCTX,
req: &schema.CreateUserSchemaRequest{
UserSchema: &schema.UserSchema{
Type: gofakeit.Name(),
Type: integration.UserSchemaName(),
DataType: &schema.UserSchema_Schema{
Schema: func() *structpb.Struct {
s := new(structpb.Struct)
@@ -211,7 +210,7 @@ func TestServer_CreateUserSchema(t *testing.T) {
ctx: isolatedIAMOwnerCTX,
req: &schema.CreateUserSchemaRequest{
UserSchema: &schema.UserSchema{
Type: gofakeit.Name(),
Type: integration.UserSchemaName(),
DataType: &schema.UserSchema_Schema{
Schema: func() *structpb.Struct {
s := new(structpb.Struct)
@@ -246,7 +245,7 @@ func TestServer_CreateUserSchema(t *testing.T) {
ctx: isolatedIAMOwnerCTX,
req: &schema.CreateUserSchemaRequest{
UserSchema: &schema.UserSchema{
Type: gofakeit.Name(),
Type: integration.UserSchemaName(),
DataType: &schema.UserSchema_Schema{
Schema: func() *structpb.Struct {
s := new(structpb.Struct)
@@ -329,7 +328,7 @@ func TestServer_UpdateUserSchema(t *testing.T) {
ctx: instance.WithAuthorization(context.Background(), integration.UserTypeOrgOwner),
req: &schema.PatchUserSchemaRequest{
UserSchema: &schema.PatchUserSchema{
Type: gu.Ptr(gofakeit.Name()),
Type: gu.Ptr(integration.UserSchemaName()),
},
},
},
@@ -386,7 +385,7 @@ func TestServer_UpdateUserSchema(t *testing.T) {
ctx: isolatedIAMOwnerCTX,
req: &schema.PatchUserSchemaRequest{
UserSchema: &schema.PatchUserSchema{
Type: gu.Ptr(gofakeit.Name()),
Type: gu.Ptr(integration.UserSchemaName()),
},
},
},
@@ -570,7 +569,7 @@ func TestServer_UpdateUserSchema(t *testing.T) {
ctx: isolatedIAMOwnerCTX,
req: &schema.PatchUserSchemaRequest{
UserSchema: &schema.PatchUserSchema{
Type: gu.Ptr(gofakeit.Name()),
Type: gu.Ptr(integration.UserSchemaName()),
},
},
},