From 2dc44031b638ca938de35a87d2d4729d402ac228 Mon Sep 17 00:00:00 2001 From: Iraq Jaber Date: Mon, 11 Aug 2025 10:15:55 +0100 Subject: [PATCH] fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! added first event --- backend/v3/domain/id_provider.go | 1 + .../database/events_testing/events_test.go | 2 +- .../database/events_testing/id_provider_test.go | 2 +- .../database/repository/id_provider_test.go | 16 ++++++++++------ .../query/projection/idp_template_relational.go | 5 ++--- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/backend/v3/domain/id_provider.go b/backend/v3/domain/id_provider.go index d5f096a80b..6161108f2d 100644 --- a/backend/v3/domain/id_provider.go +++ b/backend/v3/domain/id_provider.go @@ -52,6 +52,7 @@ const ( OIDCMappingFieldPreferredLoginName OIDCMappingFieldEmail // count is for validation purposes + //nolint: unused oidcMappingFieldCount ) diff --git a/backend/v3/storage/database/events_testing/events_test.go b/backend/v3/storage/database/events_testing/events_test.go index ce31020c40..cd82855513 100644 --- a/backend/v3/storage/database/events_testing/events_test.go +++ b/backend/v3/storage/database/events_testing/events_test.go @@ -29,7 +29,7 @@ var ( SystemClient system.SystemServiceClient OrgClient v2beta_org.OrganizationServiceClient AdminClient admin.AdminServiceClient - MgmtClient mgmt.ManagementServiceClient + MgmtClient mgmt.ManagementServiceClient ) var pool database.Pool diff --git a/backend/v3/storage/database/events_testing/id_provider_test.go b/backend/v3/storage/database/events_testing/id_provider_test.go index 4cc1dbc31b..e24f465261 100644 --- a/backend/v3/storage/database/events_testing/id_provider_test.go +++ b/backend/v3/storage/database/events_testing/id_provider_test.go @@ -9,6 +9,7 @@ import ( "github.com/brianvoe/gofakeit/v6" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + durationpb "google.golang.org/protobuf/types/known/durationpb" "github.com/zitadel/zitadel/backend/v3/domain" "github.com/zitadel/zitadel/backend/v3/storage/database" @@ -18,7 +19,6 @@ import ( "github.com/zitadel/zitadel/pkg/grpc/admin" "github.com/zitadel/zitadel/pkg/grpc/idp" idp_grpc "github.com/zitadel/zitadel/pkg/grpc/idp" - durationpb "google.golang.org/protobuf/types/known/durationpb" ) var validSAMLMetadata1 = []byte(` diff --git a/backend/v3/storage/database/repository/id_provider_test.go b/backend/v3/storage/database/repository/id_provider_test.go index 75418b3bea..04d41e713d 100644 --- a/backend/v3/storage/database/repository/id_provider_test.go +++ b/backend/v3/storage/database/repository/id_provider_test.go @@ -5,11 +5,11 @@ import ( "testing" "time" - "github.com/muhlemmer/gu" - "github.com/brianvoe/gofakeit/v6" + "github.com/muhlemmer/gu" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/zitadel/zitadel/backend/v3/domain" "github.com/zitadel/zitadel/backend/v3/storage/database" "github.com/zitadel/zitadel/backend/v3/storage/database/repository" @@ -175,7 +175,7 @@ func TestCreateIDProvider(t *testing.T) { State: domain.OrgStateActive.String(), } organizationRepo := repository.OrganizationRepository(pool) - err = organizationRepo.Create(t.Context(), &org) + err = organizationRepo.Create(ctx, &org) require.NoError(t, err) idpRepo := repository.IDProviderRepository(pool) @@ -876,6 +876,10 @@ func TestGetIDProvider(t *testing.T) { } } +// gocognit linting fails due to number of test cases +// and the fact that each test case has a testFunc() +// +//nolint:gocognit func TestListIDProvider(t *testing.T) { ctx := t.Context() pool, stop, err := newEmbeddedDB(ctx) @@ -944,7 +948,7 @@ func TestListIDProvider(t *testing.T) { State: domain.OrgStateActive.String(), } organizationRepo := repository.OrganizationRepository(pool) - err = organizationRepo.Create(t.Context(), &org) + err = organizationRepo.Create(ctx, &org) require.NoError(t, err) // create idp @@ -1008,7 +1012,7 @@ func TestListIDProvider(t *testing.T) { State: domain.OrgStateActive.String(), } organizationRepo := repository.OrganizationRepository(pool) - err = organizationRepo.Create(t.Context(), &org) + err = organizationRepo.Create(ctx, &org) require.NoError(t, err) // create idp @@ -1670,7 +1674,7 @@ func TestListIDProvider(t *testing.T) { require.NoError(t, err) }) - ctx := t.Context() + ctx := context.WithoutCancel(t.Context()) idps := tt.testFunc(ctx, t) diff --git a/internal/query/projection/idp_template_relational.go b/internal/query/projection/idp_template_relational.go index 6533adb992..c0b3fc1420 100644 --- a/internal/query/projection/idp_template_relational.go +++ b/internal/query/projection/idp_template_relational.go @@ -5,14 +5,13 @@ import ( "encoding/json" "github.com/zitadel/zitadel/backend/v3/domain" + db_domain "github.com/zitadel/zitadel/backend/v3/domain" "github.com/zitadel/zitadel/backend/v3/storage/database/dialect/postgres" "github.com/zitadel/zitadel/backend/v3/storage/database/repository" - "github.com/zitadel/zitadel/internal/repository/idpconfig" - - db_domain "github.com/zitadel/zitadel/backend/v3/domain" "github.com/zitadel/zitadel/internal/eventstore" "github.com/zitadel/zitadel/internal/eventstore/handler/v2" "github.com/zitadel/zitadel/internal/repository/idp" + "github.com/zitadel/zitadel/internal/repository/idpconfig" "github.com/zitadel/zitadel/internal/repository/instance" "github.com/zitadel/zitadel/internal/repository/org" "github.com/zitadel/zitadel/internal/zerrors"