mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-20 08:57:42 +00:00
test(integration): panic on internal errors
This commit is contained in:
@@ -40,7 +40,7 @@ func (m *SystemFeatures) isEmpty() bool {
|
|||||||
|
|
||||||
func (c *Commands) SetSystemFeatures(ctx context.Context, f *SystemFeatures) (*domain.ObjectDetails, error) {
|
func (c *Commands) SetSystemFeatures(ctx context.Context, f *SystemFeatures) (*domain.ObjectDetails, error) {
|
||||||
if f.isEmpty() {
|
if f.isEmpty() {
|
||||||
return nil, zerrors.ThrowInternal(nil, "COMMAND-Oop8a", "Errors.NoChangesFound")
|
return nil, zerrors.ThrowInvalidArgument(nil, "COMMAND-Oop8a", "Errors.NoChangesFound")
|
||||||
}
|
}
|
||||||
wm := NewSystemFeaturesWriteModel()
|
wm := NewSystemFeaturesWriteModel()
|
||||||
if err := c.eventstore.FilterToQueryReducer(ctx, wm); err != nil {
|
if err := c.eventstore.FilterToQueryReducer(ctx, wm); err != nil {
|
||||||
|
@@ -12,8 +12,10 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"github.com/zitadel/logging"
|
"github.com/zitadel/logging"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
|
"google.golang.org/grpc/codes"
|
||||||
"google.golang.org/grpc/credentials/insecure"
|
"google.golang.org/grpc/credentials/insecure"
|
||||||
"google.golang.org/grpc/metadata"
|
"google.golang.org/grpc/metadata"
|
||||||
|
"google.golang.org/grpc/status"
|
||||||
"google.golang.org/protobuf/types/known/durationpb"
|
"google.golang.org/protobuf/types/known/durationpb"
|
||||||
"google.golang.org/protobuf/types/known/structpb"
|
"google.golang.org/protobuf/types/known/structpb"
|
||||||
|
|
||||||
@@ -72,9 +74,17 @@ type Client struct {
|
|||||||
SCIM *scim.Client
|
SCIM *scim.Client
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// newClient creates a new Zitadel client that panics on each internal error.
|
||||||
func newClient(ctx context.Context, target string) (*Client, error) {
|
func newClient(ctx context.Context, target string) (*Client, error) {
|
||||||
cc, err := grpc.NewClient(target,
|
cc, err := grpc.NewClient(target,
|
||||||
grpc.WithTransportCredentials(insecure.NewCredentials()),
|
grpc.WithTransportCredentials(insecure.NewCredentials()),
|
||||||
|
grpc.WithUnaryInterceptor(func(ctx context.Context, method string, req, reply any, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error {
|
||||||
|
err := invoker(ctx, method, req, reply, cc, opts...)
|
||||||
|
if status.Convert(err).Code() == codes.Internal {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Reference in New Issue
Block a user