feat: limit audit trail (#6744)

* feat: enable limiting audit trail

* support AddExclusiveQuery

* fix invalid condition

* register event mappers

* fix NullDuration validity

* test query side for limits

* lint

* acceptance test audit trail limit

* fix acceptance test

* translate limits not found

* update tests

* fix linting

* add audit log retention to default instance

* fix tests

* update docs

* remove todo

* improve test name
This commit is contained in:
Elio Bischof
2023-10-25 13:42:00 +02:00
committed by GitHub
parent 1c839e308b
commit 385a55bd21
52 changed files with 1778 additions and 172 deletions

View File

@@ -9,8 +9,6 @@ import (
"testing"
"time"
"github.com/jackc/pgtype"
errs "github.com/zitadel/zitadel/internal/errors"
)
@@ -33,19 +31,6 @@ var (
}
)
func dayNow() time.Time {
return time.Now().Truncate(24 * time.Hour)
}
func interval(t *testing.T, src time.Duration) pgtype.Interval {
interval := pgtype.Interval{}
err := interval.Set(src)
if err != nil {
t.Fatal(err)
}
return interval
}
func Test_QuotaPrepare(t *testing.T) {
type want struct {
sqlExpectations sqlExpectation
@@ -84,8 +69,8 @@ func Test_QuotaPrepare(t *testing.T) {
quotaCols,
[]driver.Value{
"quota-id",
dayNow(),
interval(t, time.Hour*24),
dayNow,
intervalDriverValue(t, time.Hour*24),
uint64(1000),
true,
testNow,
@@ -94,9 +79,9 @@ func Test_QuotaPrepare(t *testing.T) {
},
object: &Quota{
ID: "quota-id",
From: dayNow(),
From: dayNow,
ResetInterval: time.Hour * 24,
CurrentPeriodStart: dayNow(),
CurrentPeriodStart: dayNow,
Amount: 1000,
Limit: true,
},