mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 13:19:21 +00:00
fixup! fixup! fixup! fixup! fixup! feat(db): Adding identity_providers table for relational database
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
||||
"github.com/zitadel/zitadel/backend/v3/storage/database"
|
||||
"github.com/zitadel/zitadel/backend/v3/storage/database/dialect/postgres"
|
||||
"github.com/zitadel/zitadel/internal/integration"
|
||||
"github.com/zitadel/zitadel/pkg/grpc/admin"
|
||||
v2beta_org "github.com/zitadel/zitadel/pkg/grpc/org/v2beta"
|
||||
"github.com/zitadel/zitadel/pkg/grpc/system"
|
||||
)
|
||||
@@ -26,6 +27,7 @@ var (
|
||||
Instance *integration.Instance
|
||||
SystemClient system.SystemServiceClient
|
||||
OrgClient v2beta_org.OrganizationServiceClient
|
||||
AdminClient admin.AdminServiceClient
|
||||
)
|
||||
|
||||
var pool database.Pool
|
||||
@@ -40,6 +42,7 @@ func TestMain(m *testing.M) {
|
||||
CTX = Instance.WithAuthorization(ctx, integration.UserTypeIAMOwner)
|
||||
SystemClient = integration.SystemClient()
|
||||
OrgClient = Instance.Client.OrgV2beta
|
||||
AdminClient = Instance.Client.Admin
|
||||
|
||||
var err error
|
||||
dbConfig, err := pgxpool.ParseConfig(ConnString)
|
||||
|
@@ -0,0 +1,64 @@
|
||||
//go:build integration
|
||||
|
||||
package events_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/brianvoe/gofakeit/v6"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/zitadel/zitadel/pkg/grpc/admin"
|
||||
"github.com/zitadel/zitadel/pkg/grpc/idp"
|
||||
v2beta_org "github.com/zitadel/zitadel/pkg/grpc/org/v2beta"
|
||||
)
|
||||
|
||||
func TestServer_TestIDProviderReduces(t *testing.T) {
|
||||
// instanceID := Instance.ID()
|
||||
|
||||
t.Run("test org add reduces", func(t *testing.T) {
|
||||
// beforeCreate := time.Now()
|
||||
orgName := gofakeit.Name()
|
||||
|
||||
// create org
|
||||
_, err := OrgClient.CreateOrganization(CTX, &v2beta_org.CreateOrganizationRequest{
|
||||
Name: orgName,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
// afterCreate := time.Now()
|
||||
|
||||
addOCID, err := AdminClient.AddOIDCIDP(CTX, &admin.AddOIDCIDPRequest{
|
||||
Name: gofakeit.Name(),
|
||||
StylingType: idp.IDPStylingType_STYLING_TYPE_GOOGLE,
|
||||
ClientId: "clientID",
|
||||
ClientSecret: "clientSecret",
|
||||
Issuer: "issuer",
|
||||
Scopes: []string{"scope"},
|
||||
DisplayNameMapping: idp.OIDCMappingField_OIDC_MAPPING_FIELD_EMAIL,
|
||||
UsernameMapping: idp.OIDCMappingField_OIDC_MAPPING_FIELD_EMAIL,
|
||||
AutoRegister: true,
|
||||
})
|
||||
fmt.Printf("@@ >>>>>>>>>>>>>>>>>>>>>>>>>>>> addOCID = %+v\n", addOCID)
|
||||
fmt.Printf("@@ >>>>>>>>>>>>>>>>>>>>>>>>>>>> err = %+v\n", err)
|
||||
|
||||
// idpRepo := repository.IDProviderRepository(pool)
|
||||
|
||||
// retryDuration, tick := integration.WaitForAndTickWithMaxDuration(CTX, time.Minute)
|
||||
// assert.EventuallyWithT(t, func(tt *assert.CollectT) {
|
||||
// organization, err := idpRepo.Get(CTX,
|
||||
// idpRepo.NameCondition(orgName),
|
||||
// instanceID,
|
||||
// )
|
||||
// require.NoError(tt, err)
|
||||
|
||||
// // event org.added
|
||||
// assert.NotNil(t, organization.ID)
|
||||
// assert.Equal(t, orgName, organization.Name)
|
||||
// assert.NotNil(t, organization.InstanceID)
|
||||
// assert.Equal(t, domain.OrgStateActive.String(), organization.State)
|
||||
// assert.WithinRange(t, organization.CreatedAt, beforeCreate, afterCreate)
|
||||
// assert.WithinRange(t, organization.UpdatedAt, beforeCreate, afterCreate)
|
||||
// }, retryDuration, tick)
|
||||
})
|
||||
}
|
@@ -10,6 +10,7 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/zitadel/zitadel/backend/v3/storage/database"
|
||||
"github.com/zitadel/zitadel/backend/v3/storage/database/repository"
|
||||
"github.com/zitadel/zitadel/internal/integration"
|
||||
"github.com/zitadel/zitadel/pkg/grpc/system"
|
||||
@@ -131,7 +132,8 @@ func TestServer_TestInstanceReduces(t *testing.T) {
|
||||
)
|
||||
// event instance.removed
|
||||
assert.Nil(t, instance)
|
||||
require.Equal(t, repository.ErrResourceDoesNotExist, err)
|
||||
// require.Equal(t, repository.ErrResourceDoesNotExist, err)
|
||||
require.ErrorIs(t, &database.NoRowFoundError{}, err)
|
||||
}, retryDuration, tick)
|
||||
})
|
||||
}
|
||||
|
@@ -11,6 +11,7 @@ import (
|
||||
"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"
|
||||
"github.com/zitadel/zitadel/internal/integration"
|
||||
v2beta_org "github.com/zitadel/zitadel/pkg/grpc/org/v2beta"
|
||||
@@ -208,7 +209,7 @@ func TestServer_TestOrganizationReduces(t *testing.T) {
|
||||
orgRepo.NameCondition(orgName),
|
||||
instanceID,
|
||||
)
|
||||
require.Equal(t, repository.ErrResourceDoesNotExist, err)
|
||||
require.ErrorIs(t, &database.NoRowFoundError{}, err)
|
||||
|
||||
// event org.remove
|
||||
assert.Nil(t, organization)
|
||||
|
Reference in New Issue
Block a user