mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-03 13:03:32 +00:00
feat: save last occurrence of failed events and fix instance filtering (#4710)
* fix: filter failed events and current sequence correctly * fix failed events sorting column * feat: save last occurrence of failed event * fix failedEvents query and update sql statements * change sql statement to only create index * fix linting * fix linting * Update internal/query/failed_events.go Co-authored-by: Silvan <silvan.reusser@gmail.com> * update job name on test-docs to match the one from test-code Co-authored-by: Silvan <silvan.reusser@gmail.com>
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
package admin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/zitadel/zitadel/internal/api/authz"
|
||||
"github.com/zitadel/zitadel/internal/test"
|
||||
"github.com/zitadel/zitadel/internal/view/model"
|
||||
admin_pb "github.com/zitadel/zitadel/pkg/grpc/admin"
|
||||
@@ -25,6 +28,7 @@ func TestFailedEventsToPbFields(t *testing.T) {
|
||||
ViewName: "users",
|
||||
FailedSequence: 456,
|
||||
FailureCount: 5,
|
||||
LastFailed: time.Now(),
|
||||
ErrMsg: "some error",
|
||||
},
|
||||
},
|
||||
@@ -57,6 +61,7 @@ func TestFailedEventToPbFields(t *testing.T) {
|
||||
ViewName: "users",
|
||||
FailedSequence: 456,
|
||||
FailureCount: 5,
|
||||
LastFailed: time.Now(),
|
||||
ErrMsg: "some error",
|
||||
},
|
||||
},
|
||||
@@ -70,6 +75,7 @@ func TestFailedEventToPbFields(t *testing.T) {
|
||||
|
||||
func TestRemoveFailedEventRequestToModelFields(t *testing.T) {
|
||||
type args struct {
|
||||
ctx context.Context
|
||||
req *admin_pb.RemoveFailedEventRequest
|
||||
}
|
||||
tests := []struct {
|
||||
@@ -79,6 +85,7 @@ func TestRemoveFailedEventRequestToModelFields(t *testing.T) {
|
||||
{
|
||||
"all fields",
|
||||
args{
|
||||
ctx: authz.WithInstanceID(context.Background(), "instanceID"),
|
||||
req: &admin_pb.RemoveFailedEventRequest{
|
||||
Database: "admin",
|
||||
ViewName: "users",
|
||||
@@ -88,7 +95,7 @@ func TestRemoveFailedEventRequestToModelFields(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
converted := RemoveFailedEventRequestToModel(tt.args.req)
|
||||
test.AssertFieldsMapped(t, converted, "FailureCount", "ErrMsg")
|
||||
converted := RemoveFailedEventRequestToModel(tt.args.ctx, tt.args.req)
|
||||
test.AssertFieldsMapped(t, converted, "FailureCount", "LastFailed", "ErrMsg")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user