mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 13:19:21 +00:00
fixes
This commit is contained in:
2
Makefile
2
Makefile
@@ -152,7 +152,7 @@ core_integration_server_stop:
|
|||||||
|
|
||||||
.PHONY: core_integration_reports
|
.PHONY: core_integration_reports
|
||||||
core_integration_reports:
|
core_integration_reports:
|
||||||
go tool covdata textfmt -i=tmp/coverage -pkg=github.com/zitadel/zitadel/internal/...,github.com/zitadel/zitadel/cmd/...,,github.com/zitadel/zitadel/backend/... -o profile.cov
|
go tool covdata textfmt -i=tmp/coverage -pkg=github.com/zitadel/zitadel/internal/...,github.com/zitadel/zitadel/cmd/...,github.com/zitadel/zitadel/backend/... -o profile.cov
|
||||||
|
|
||||||
.PHONY: core_integration_test
|
.PHONY: core_integration_test
|
||||||
core_integration_test: core_integration_server_start core_integration_test_packages core_integration_server_stop core_integration_reports
|
core_integration_test: core_integration_server_start core_integration_test_packages core_integration_server_stop core_integration_reports
|
||||||
|
@@ -19,7 +19,7 @@ type Instance struct {
|
|||||||
CreatedAt time.Time `json:"createdAt" db:"created_at"`
|
CreatedAt time.Time `json:"createdAt" db:"created_at"`
|
||||||
UpdatedAt time.Time `json:"updatedAt" db:"updated_at"`
|
UpdatedAt time.Time `json:"updatedAt" db:"updated_at"`
|
||||||
|
|
||||||
Domains []*InstanceDomain `json:"domains,omitempty" db:"-"`
|
Domains []*InstanceDomain `json:"domains,omitempty" db:"domains"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type instanceCacheIndex uint8
|
type instanceCacheIndex uint8
|
||||||
|
@@ -22,7 +22,7 @@ type Organization struct {
|
|||||||
CreatedAt time.Time `json:"createdAt,omitzero" db:"created_at"`
|
CreatedAt time.Time `json:"createdAt,omitzero" db:"created_at"`
|
||||||
UpdatedAt time.Time `json:"updatedAt,omitzero" db:"updated_at"`
|
UpdatedAt time.Time `json:"updatedAt,omitzero" db:"updated_at"`
|
||||||
|
|
||||||
Domains []*OrganizationDomain `json:"domains,omitempty" db:"-"`
|
Domains []*OrganizationDomain `json:"domains,omitempty" db:"domains"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// OrgIdentifierCondition is used to help specify a single Organization,
|
// OrgIdentifierCondition is used to help specify a single Organization,
|
||||||
|
@@ -6,6 +6,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/brianvoe/gofakeit/v6"
|
"github.com/brianvoe/gofakeit/v6"
|
||||||
|
"github.com/muhlemmer/gu"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
@@ -337,6 +338,51 @@ func TestGetInstance(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
}(),
|
}(),
|
||||||
|
{
|
||||||
|
name: "happy path including domains",
|
||||||
|
testFunc: func(ctx context.Context, t *testing.T) *domain.Instance {
|
||||||
|
instanceRepo := repository.InstanceRepository(pool)
|
||||||
|
instanceId := gofakeit.Name()
|
||||||
|
instanceName := gofakeit.Name()
|
||||||
|
|
||||||
|
inst := domain.Instance{
|
||||||
|
ID: instanceId,
|
||||||
|
Name: instanceName,
|
||||||
|
DefaultOrgID: "defaultOrgId",
|
||||||
|
IAMProjectID: "iamProject",
|
||||||
|
ConsoleClientID: "consoleCLient",
|
||||||
|
ConsoleAppID: "consoleApp",
|
||||||
|
DefaultLanguage: "defaultLanguage",
|
||||||
|
}
|
||||||
|
|
||||||
|
// create instance
|
||||||
|
err := instanceRepo.Create(ctx, &inst)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
domainRepo := instanceRepo.Domains(false)
|
||||||
|
d := &domain.AddInstanceDomain{
|
||||||
|
InstanceID: inst.ID,
|
||||||
|
Domain: gofakeit.DomainName(),
|
||||||
|
IsPrimary: gu.Ptr(true),
|
||||||
|
IsGenerated: gu.Ptr(false),
|
||||||
|
Type: domain.DomainTypeCustom,
|
||||||
|
}
|
||||||
|
err = domainRepo.Add(ctx, d)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
inst.Domains = append(inst.Domains, &domain.InstanceDomain{
|
||||||
|
InstanceID: d.InstanceID,
|
||||||
|
Domain: d.Domain,
|
||||||
|
IsPrimary: d.IsPrimary,
|
||||||
|
IsGenerated: d.IsGenerated,
|
||||||
|
Type: d.Type,
|
||||||
|
CreatedAt: d.CreatedAt,
|
||||||
|
UpdatedAt: d.UpdatedAt,
|
||||||
|
})
|
||||||
|
|
||||||
|
return &inst
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "get non existent instance",
|
name: "get non existent instance",
|
||||||
testFunc: func(ctx context.Context, t *testing.T) *domain.Instance {
|
testFunc: func(ctx context.Context, t *testing.T) *domain.Instance {
|
||||||
|
@@ -471,6 +471,52 @@ func TestGetOrganization(t *testing.T) {
|
|||||||
orgIdentifierCondition: orgRepo.IDCondition(organizationId),
|
orgIdentifierCondition: orgRepo.IDCondition(organizationId),
|
||||||
}
|
}
|
||||||
}(),
|
}(),
|
||||||
|
func() test {
|
||||||
|
organizationId := gofakeit.Name()
|
||||||
|
return test{
|
||||||
|
name: "happy path get using id including domain",
|
||||||
|
testFunc: func(ctx context.Context, t *testing.T) *domain.Organization {
|
||||||
|
organizationName := gofakeit.Name()
|
||||||
|
|
||||||
|
org := domain.Organization{
|
||||||
|
ID: organizationId,
|
||||||
|
Name: organizationName,
|
||||||
|
InstanceID: instanceId,
|
||||||
|
State: domain.OrgStateActive,
|
||||||
|
}
|
||||||
|
|
||||||
|
// create organization
|
||||||
|
err := orgRepo.Create(ctx, &org)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
d := &domain.AddOrganizationDomain{
|
||||||
|
InstanceID: org.InstanceID,
|
||||||
|
OrgID: org.ID,
|
||||||
|
Domain: gofakeit.DomainName(),
|
||||||
|
IsVerified: true,
|
||||||
|
IsPrimary: true,
|
||||||
|
}
|
||||||
|
err = orgRepo.Domains(false).Add(ctx, d)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
org.Domains = []*domain.OrganizationDomain{
|
||||||
|
{
|
||||||
|
InstanceID: d.InstanceID,
|
||||||
|
OrgID: d.OrgID,
|
||||||
|
ValidationType: d.ValidationType,
|
||||||
|
Domain: d.Domain,
|
||||||
|
IsPrimary: d.IsPrimary,
|
||||||
|
IsVerified: d.IsVerified,
|
||||||
|
CreatedAt: d.CreatedAt,
|
||||||
|
UpdatedAt: d.UpdatedAt,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
return &org
|
||||||
|
},
|
||||||
|
orgIdentifierCondition: orgRepo.IDCondition(organizationId),
|
||||||
|
}
|
||||||
|
}(),
|
||||||
func() test {
|
func() test {
|
||||||
organizationName := gofakeit.Name()
|
organizationName := gofakeit.Name()
|
||||||
return test{
|
return test{
|
||||||
|
Reference in New Issue
Block a user