test(integration): panic on internal errors

This commit is contained in:
Elio Bischof
2025-04-29 21:20:27 +02:00
parent 181186e477
commit 722e6c1e42
2 changed files with 11 additions and 1 deletions

View File

@@ -40,7 +40,7 @@ func (m *SystemFeatures) isEmpty() bool {
func (c *Commands) SetSystemFeatures(ctx context.Context, f *SystemFeatures) (*domain.ObjectDetails, error) {
if f.isEmpty() {
return nil, zerrors.ThrowInternal(nil, "COMMAND-Oop8a", "Errors.NoChangesFound")
return nil, zerrors.ThrowInvalidArgument(nil, "COMMAND-Oop8a", "Errors.NoChangesFound")
}
wm := NewSystemFeaturesWriteModel()
if err := c.eventstore.FilterToQueryReducer(ctx, wm); err != nil {

View File

@@ -12,8 +12,10 @@ import (
"github.com/stretchr/testify/require"
"github.com/zitadel/logging"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/types/known/durationpb"
"google.golang.org/protobuf/types/known/structpb"
@@ -72,9 +74,17 @@ type Client struct {
SCIM *scim.Client
}
// newClient creates a new Zitadel client that panics on each internal error.
func newClient(ctx context.Context, target string) (*Client, error) {
cc, err := grpc.NewClient(target,
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 {
return nil, err