mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 21:27:42 +00:00
chore: fix flakiness in gofakeit usage with additional random string (#10385)
# Which Problems Are Solved Flakiness in integration tests regarding gofakeit functions, which provided the same names on 2 different occasions. # How the Problems Are Solved Attach a random string to the provided names, so that they are not dependent on the gofakeit code. # Additional Changes None # Additional Context None --------- Co-authored-by: Marco A. <marco@zitadel.com>
This commit is contained in:
@@ -41,7 +41,7 @@ func TestServer_GetSecuritySettings(t *testing.T) {
|
||||
}{
|
||||
{
|
||||
name: "permission error",
|
||||
ctx: Instance.WithAuthorization(CTX, integration.UserTypeOrgOwner),
|
||||
ctx: Instance.WithAuthorizationToken(CTX, integration.UserTypeOrgOwner),
|
||||
wantErr: true,
|
||||
},
|
||||
{
|
||||
@@ -96,26 +96,26 @@ func idpResponse(id, name string, linking, creation, autoCreation, autoUpdate bo
|
||||
|
||||
func TestServer_GetActiveIdentityProviders(t *testing.T) {
|
||||
instance := integration.NewInstance(CTX)
|
||||
isolatedIAMOwnerCTX := instance.WithAuthorization(CTX, integration.UserTypeIAMOwner)
|
||||
isolatedIAMOwnerCTX := instance.WithAuthorizationToken(CTX, integration.UserTypeIAMOwner)
|
||||
|
||||
instance.AddGenericOAuthProvider(isolatedIAMOwnerCTX, gofakeit.AppName()) // inactive
|
||||
idpActiveName := gofakeit.AppName()
|
||||
instance.AddGenericOAuthProvider(isolatedIAMOwnerCTX, integration.IDPName()) // inactive
|
||||
idpActiveName := integration.IDPName()
|
||||
idpActiveResp := instance.AddGenericOAuthProvider(isolatedIAMOwnerCTX, idpActiveName)
|
||||
instance.AddProviderToDefaultLoginPolicy(isolatedIAMOwnerCTX, idpActiveResp.GetId())
|
||||
idpActiveResponse := idpResponse(idpActiveResp.GetId(), idpActiveName, true, true, true, true, idp_pb.AutoLinkingOption_AUTO_LINKING_OPTION_USERNAME)
|
||||
idpLinkingDisallowedName := gofakeit.AppName()
|
||||
idpLinkingDisallowedName := integration.IDPName()
|
||||
idpLinkingDisallowedResp := instance.AddGenericOAuthProviderWithOptions(isolatedIAMOwnerCTX, idpLinkingDisallowedName, false, true, true, idp.AutoLinkingOption_AUTO_LINKING_OPTION_USERNAME)
|
||||
instance.AddProviderToDefaultLoginPolicy(isolatedIAMOwnerCTX, idpLinkingDisallowedResp.GetId())
|
||||
idpLinkingDisallowedResponse := idpResponse(idpLinkingDisallowedResp.GetId(), idpLinkingDisallowedName, false, true, true, true, idp_pb.AutoLinkingOption_AUTO_LINKING_OPTION_USERNAME)
|
||||
idpCreationDisallowedName := gofakeit.AppName()
|
||||
idpCreationDisallowedName := integration.IDPName()
|
||||
idpCreationDisallowedResp := instance.AddGenericOAuthProviderWithOptions(isolatedIAMOwnerCTX, idpCreationDisallowedName, true, false, true, idp.AutoLinkingOption_AUTO_LINKING_OPTION_USERNAME)
|
||||
instance.AddProviderToDefaultLoginPolicy(isolatedIAMOwnerCTX, idpCreationDisallowedResp.GetId())
|
||||
idpCreationDisallowedResponse := idpResponse(idpCreationDisallowedResp.GetId(), idpCreationDisallowedName, true, false, true, true, idp_pb.AutoLinkingOption_AUTO_LINKING_OPTION_USERNAME)
|
||||
idpNoAutoCreationName := gofakeit.AppName()
|
||||
idpNoAutoCreationName := integration.IDPName()
|
||||
idpNoAutoCreationResp := instance.AddGenericOAuthProviderWithOptions(isolatedIAMOwnerCTX, idpNoAutoCreationName, true, true, false, idp.AutoLinkingOption_AUTO_LINKING_OPTION_USERNAME)
|
||||
instance.AddProviderToDefaultLoginPolicy(isolatedIAMOwnerCTX, idpNoAutoCreationResp.GetId())
|
||||
idpNoAutoCreationResponse := idpResponse(idpNoAutoCreationResp.GetId(), idpNoAutoCreationName, true, true, false, true, idp_pb.AutoLinkingOption_AUTO_LINKING_OPTION_USERNAME)
|
||||
idpNoAutoLinkingName := gofakeit.AppName()
|
||||
idpNoAutoLinkingName := integration.IDPName()
|
||||
idpNoAutoLinkingResp := instance.AddGenericOAuthProviderWithOptions(isolatedIAMOwnerCTX, idpNoAutoLinkingName, true, true, true, idp.AutoLinkingOption_AUTO_LINKING_OPTION_UNSPECIFIED)
|
||||
instance.AddProviderToDefaultLoginPolicy(isolatedIAMOwnerCTX, idpNoAutoLinkingResp.GetId())
|
||||
idpNoAutoLinkingResponse := idpResponse(idpNoAutoLinkingResp.GetId(), idpNoAutoLinkingName, true, true, true, true, idp_pb.AutoLinkingOption_AUTO_LINKING_OPTION_UNSPECIFIED)
|
||||
@@ -133,7 +133,7 @@ func TestServer_GetActiveIdentityProviders(t *testing.T) {
|
||||
{
|
||||
name: "permission error",
|
||||
args: args{
|
||||
ctx: instance.WithAuthorization(CTX, integration.UserTypeNoPermission),
|
||||
ctx: instance.WithAuthorizationToken(CTX, integration.UserTypeNoPermission),
|
||||
req: &settings.GetActiveIdentityProvidersRequest{},
|
||||
},
|
||||
wantErr: true,
|
||||
|
@@ -26,9 +26,9 @@ func TestMain(m *testing.M) {
|
||||
Instance = integration.NewInstance(ctx)
|
||||
|
||||
CTX = ctx
|
||||
AdminCTX = Instance.WithAuthorization(ctx, integration.UserTypeIAMOwner)
|
||||
UserTypeLoginCtx = Instance.WithAuthorization(ctx, integration.UserTypeLogin)
|
||||
OrgOwnerCtx = Instance.WithAuthorization(ctx, integration.UserTypeOrgOwner)
|
||||
AdminCTX = Instance.WithAuthorizationToken(ctx, integration.UserTypeIAMOwner)
|
||||
UserTypeLoginCtx = Instance.WithAuthorizationToken(ctx, integration.UserTypeLogin)
|
||||
OrgOwnerCtx = Instance.WithAuthorizationToken(ctx, integration.UserTypeOrgOwner)
|
||||
|
||||
Client = Instance.Client.SettingsV2
|
||||
return m.Run()
|
||||
|
@@ -35,7 +35,7 @@ func TestServer_SetSecuritySettings(t *testing.T) {
|
||||
{
|
||||
name: "permission error",
|
||||
args: args{
|
||||
ctx: Instance.WithAuthorization(CTX, integration.UserTypeOrgOwner),
|
||||
ctx: Instance.WithAuthorizationToken(CTX, integration.UserTypeOrgOwner),
|
||||
req: &settings.SetSecuritySettingsRequest{
|
||||
EmbeddedIframe: &settings.EmbeddedIframeSettings{
|
||||
Enabled: true,
|
||||
|
Reference in New Issue
Block a user