mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-30 17:26:44 +00:00
# Which Problems Are Solved This PR implements the endpoints listed in https://github.com/zitadel/zitadel/issues/10443 . # How the Problems Are Solved The implementation follows the same pattern as the Organization one. There are no peculiarities to this PR. The `Update`, `Delete` are implementing the `Commander` interface, while `Get` and `List` instance(s) endpoints are implementing the `Querier` interace. # Additional Context - Closes #10443 - Depends on #10445
51 lines
1.6 KiB
Go
51 lines
1.6 KiB
Go
package integration
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/muhlemmer/gu"
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/zitadel/zitadel/pkg/grpc/feature/v2"
|
|
)
|
|
|
|
func EnsureInstanceFeature(t *testing.T, ctx context.Context, instance *Instance, features *feature.SetInstanceFeaturesRequest, assertFeatures func(t *assert.CollectT, got *feature.GetInstanceFeaturesResponse)) {
|
|
ctx = instance.WithAuthorizationToken(ctx, UserTypeIAMOwner)
|
|
_, err := instance.Client.FeatureV2.SetInstanceFeatures(ctx, features)
|
|
require.NoError(t, err)
|
|
retryDuration, tick := WaitForAndTickWithMaxDuration(ctx, 5*time.Minute)
|
|
require.EventuallyWithT(t,
|
|
func(tt *assert.CollectT) {
|
|
got, err := instance.Client.FeatureV2.GetInstanceFeatures(ctx, &feature.GetInstanceFeaturesRequest{
|
|
Inheritance: true,
|
|
})
|
|
require.NoError(tt, err)
|
|
assertFeatures(tt, got)
|
|
},
|
|
retryDuration,
|
|
tick,
|
|
"timed out waiting for ensuring instance feature")
|
|
}
|
|
|
|
type RelationalTableFeatureMatrix struct {
|
|
State string
|
|
FeatureSet *feature.SetInstanceFeaturesRequest
|
|
}
|
|
|
|
// TODO(IAM-Marco): Once we have gotten rid of eventstore, this can be removed
|
|
func RelationalTablesEnableMatrix() []RelationalTableFeatureMatrix {
|
|
return []RelationalTableFeatureMatrix{
|
|
{
|
|
State: "when relational tables are disabled",
|
|
FeatureSet: &feature.SetInstanceFeaturesRequest{EnableRelationalTables: gu.Ptr(false)},
|
|
},
|
|
{
|
|
State: "when relational tables are enabled",
|
|
FeatureSet: &feature.SetInstanceFeaturesRequest{EnableRelationalTables: gu.Ptr(true)},
|
|
},
|
|
}
|
|
}
|