mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 00:47:33 +00:00
feat(eventstore): increase parallel write capabilities (#5940)
This implementation increases parallel write capabilities of the eventstore. Please have a look at the technical advisories: [05](https://zitadel.com/docs/support/advisory/a10005) and [06](https://zitadel.com/docs/support/advisory/a10006). The implementation of eventstore.push is rewritten and stored events are migrated to a new table `eventstore.events2`. If you are using cockroach: make sure that the database user of ZITADEL has `VIEWACTIVITY` grant. This is used to query events.
This commit is contained in:
@@ -6,8 +6,7 @@ import (
|
||||
"github.com/zitadel/zitadel/internal/domain"
|
||||
"github.com/zitadel/zitadel/internal/errors"
|
||||
"github.com/zitadel/zitadel/internal/eventstore"
|
||||
"github.com/zitadel/zitadel/internal/eventstore/handler"
|
||||
"github.com/zitadel/zitadel/internal/eventstore/repository"
|
||||
"github.com/zitadel/zitadel/internal/eventstore/handler/v2"
|
||||
"github.com/zitadel/zitadel/internal/repository/instance"
|
||||
"github.com/zitadel/zitadel/internal/repository/org"
|
||||
)
|
||||
@@ -25,17 +24,17 @@ func TestLabelPolicyProjection_reduces(t *testing.T) {
|
||||
{
|
||||
name: "org reduceAdded",
|
||||
args: args{
|
||||
event: getEvent(testEvent(
|
||||
repository.EventType(org.LabelPolicyAddedEventType),
|
||||
org.AggregateType,
|
||||
[]byte(`{"backgroundColor": "#141735", "fontColor": "#ffffff", "primaryColor": "#5282c1", "warnColor": "#ff3b5b"}`),
|
||||
), org.LabelPolicyAddedEventMapper),
|
||||
event: getEvent(
|
||||
testEvent(
|
||||
org.LabelPolicyAddedEventType,
|
||||
org.AggregateType,
|
||||
[]byte(`{"backgroundColor": "#141735", "fontColor": "#ffffff", "primaryColor": "#5282c1", "warnColor": "#ff3b5b"}`),
|
||||
), org.LabelPolicyAddedEventMapper),
|
||||
},
|
||||
reduce: (&labelPolicyProjection{}).reduceAdded,
|
||||
want: wantReduce{
|
||||
aggregateType: eventstore.AggregateType("org"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
aggregateType: eventstore.AggregateType("org"),
|
||||
sequence: 15,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -69,17 +68,17 @@ func TestLabelPolicyProjection_reduces(t *testing.T) {
|
||||
{
|
||||
name: "org reduceChanged",
|
||||
args: args{
|
||||
event: getEvent(testEvent(
|
||||
repository.EventType(org.LabelPolicyChangedEventType),
|
||||
org.AggregateType,
|
||||
[]byte(`{"backgroundColor": "#141735", "fontColor": "#ffffff", "primaryColor": "#5282c1", "warnColor": "#ff3b5b"}`),
|
||||
), org.LabelPolicyChangedEventMapper),
|
||||
event: getEvent(
|
||||
testEvent(
|
||||
org.LabelPolicyChangedEventType,
|
||||
org.AggregateType,
|
||||
[]byte(`{"backgroundColor": "#141735", "fontColor": "#ffffff", "primaryColor": "#5282c1", "warnColor": "#ff3b5b"}`),
|
||||
), org.LabelPolicyChangedEventMapper),
|
||||
},
|
||||
reduce: (&labelPolicyProjection{}).reduceChanged,
|
||||
want: wantReduce{
|
||||
aggregateType: eventstore.AggregateType("org"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
aggregateType: eventstore.AggregateType("org"),
|
||||
sequence: 15,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -103,17 +102,17 @@ func TestLabelPolicyProjection_reduces(t *testing.T) {
|
||||
{
|
||||
name: "org reduceRemoved",
|
||||
args: args{
|
||||
event: getEvent(testEvent(
|
||||
repository.EventType(org.LabelPolicyRemovedEventType),
|
||||
org.AggregateType,
|
||||
nil,
|
||||
), org.LabelPolicyRemovedEventMapper),
|
||||
event: getEvent(
|
||||
testEvent(
|
||||
org.LabelPolicyRemovedEventType,
|
||||
org.AggregateType,
|
||||
nil,
|
||||
), org.LabelPolicyRemovedEventMapper),
|
||||
},
|
||||
reduce: (&labelPolicyProjection{}).reduceRemoved,
|
||||
want: wantReduce{
|
||||
aggregateType: eventstore.AggregateType("org"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
aggregateType: eventstore.AggregateType("org"),
|
||||
sequence: 15,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -130,17 +129,17 @@ func TestLabelPolicyProjection_reduces(t *testing.T) {
|
||||
{
|
||||
name: "instance reduceInstanceRemoved",
|
||||
args: args{
|
||||
event: getEvent(testEvent(
|
||||
repository.EventType(instance.InstanceRemovedEventType),
|
||||
instance.AggregateType,
|
||||
nil,
|
||||
), instance.InstanceRemovedEventMapper),
|
||||
event: getEvent(
|
||||
testEvent(
|
||||
instance.InstanceRemovedEventType,
|
||||
instance.AggregateType,
|
||||
nil,
|
||||
), instance.InstanceRemovedEventMapper),
|
||||
},
|
||||
reduce: reduceInstanceRemovedHelper(LabelPolicyInstanceIDCol),
|
||||
want: wantReduce{
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -156,17 +155,17 @@ func TestLabelPolicyProjection_reduces(t *testing.T) {
|
||||
{
|
||||
name: "org reduceActivated",
|
||||
args: args{
|
||||
event: getEvent(testEvent(
|
||||
repository.EventType(org.LabelPolicyActivatedEventType),
|
||||
org.AggregateType,
|
||||
nil,
|
||||
), org.LabelPolicyActivatedEventMapper),
|
||||
event: getEvent(
|
||||
testEvent(
|
||||
org.LabelPolicyActivatedEventType,
|
||||
org.AggregateType,
|
||||
nil,
|
||||
), org.LabelPolicyActivatedEventMapper),
|
||||
},
|
||||
reduce: (&labelPolicyProjection{}).reduceActivated,
|
||||
want: wantReduce{
|
||||
aggregateType: eventstore.AggregateType("org"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
aggregateType: eventstore.AggregateType("org"),
|
||||
sequence: 15,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -187,17 +186,17 @@ func TestLabelPolicyProjection_reduces(t *testing.T) {
|
||||
{
|
||||
name: "org reduceLogoAdded light",
|
||||
args: args{
|
||||
event: getEvent(testEvent(
|
||||
repository.EventType(org.LabelPolicyLogoAddedEventType),
|
||||
org.AggregateType,
|
||||
[]byte(`{"storeKey": "/path/to/logo.png"}`),
|
||||
), org.LabelPolicyLogoAddedEventMapper),
|
||||
event: getEvent(
|
||||
testEvent(
|
||||
org.LabelPolicyLogoAddedEventType,
|
||||
org.AggregateType,
|
||||
[]byte(`{"storeKey": "/path/to/logo.png"}`),
|
||||
), org.LabelPolicyLogoAddedEventMapper),
|
||||
},
|
||||
reduce: (&labelPolicyProjection{}).reduceLogoAdded,
|
||||
want: wantReduce{
|
||||
aggregateType: eventstore.AggregateType("org"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
aggregateType: eventstore.AggregateType("org"),
|
||||
sequence: 15,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -218,17 +217,17 @@ func TestLabelPolicyProjection_reduces(t *testing.T) {
|
||||
{
|
||||
name: "org reduceLogoAdded dark",
|
||||
args: args{
|
||||
event: getEvent(testEvent(
|
||||
repository.EventType(org.LabelPolicyLogoDarkAddedEventType),
|
||||
org.AggregateType,
|
||||
[]byte(`{"storeKey": "/path/to/logo.png"}`),
|
||||
), org.LabelPolicyLogoDarkAddedEventMapper),
|
||||
event: getEvent(
|
||||
testEvent(
|
||||
org.LabelPolicyLogoDarkAddedEventType,
|
||||
org.AggregateType,
|
||||
[]byte(`{"storeKey": "/path/to/logo.png"}`),
|
||||
), org.LabelPolicyLogoDarkAddedEventMapper),
|
||||
},
|
||||
reduce: (&labelPolicyProjection{}).reduceLogoAdded,
|
||||
want: wantReduce{
|
||||
aggregateType: eventstore.AggregateType("org"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
aggregateType: eventstore.AggregateType("org"),
|
||||
sequence: 15,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -249,17 +248,17 @@ func TestLabelPolicyProjection_reduces(t *testing.T) {
|
||||
{
|
||||
name: "org reduceIconAdded light",
|
||||
args: args{
|
||||
event: getEvent(testEvent(
|
||||
repository.EventType(org.LabelPolicyIconAddedEventType),
|
||||
org.AggregateType,
|
||||
[]byte(`{"storeKey": "/path/to/icon.png"}`),
|
||||
), org.LabelPolicyIconAddedEventMapper),
|
||||
event: getEvent(
|
||||
testEvent(
|
||||
org.LabelPolicyIconAddedEventType,
|
||||
org.AggregateType,
|
||||
[]byte(`{"storeKey": "/path/to/icon.png"}`),
|
||||
), org.LabelPolicyIconAddedEventMapper),
|
||||
},
|
||||
reduce: (&labelPolicyProjection{}).reduceIconAdded,
|
||||
want: wantReduce{
|
||||
aggregateType: eventstore.AggregateType("org"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
aggregateType: eventstore.AggregateType("org"),
|
||||
sequence: 15,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -280,17 +279,17 @@ func TestLabelPolicyProjection_reduces(t *testing.T) {
|
||||
{
|
||||
name: "org reduceIconAdded dark",
|
||||
args: args{
|
||||
event: getEvent(testEvent(
|
||||
repository.EventType(org.LabelPolicyIconDarkAddedEventType),
|
||||
org.AggregateType,
|
||||
[]byte(`{"storeKey": "/path/to/icon.png"}`),
|
||||
), org.LabelPolicyIconDarkAddedEventMapper),
|
||||
event: getEvent(
|
||||
testEvent(
|
||||
org.LabelPolicyIconDarkAddedEventType,
|
||||
org.AggregateType,
|
||||
[]byte(`{"storeKey": "/path/to/icon.png"}`),
|
||||
), org.LabelPolicyIconDarkAddedEventMapper),
|
||||
},
|
||||
reduce: (&labelPolicyProjection{}).reduceIconAdded,
|
||||
want: wantReduce{
|
||||
aggregateType: eventstore.AggregateType("org"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
aggregateType: eventstore.AggregateType("org"),
|
||||
sequence: 15,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -311,17 +310,17 @@ func TestLabelPolicyProjection_reduces(t *testing.T) {
|
||||
{
|
||||
name: "org reduceLogoRemoved light",
|
||||
args: args{
|
||||
event: getEvent(testEvent(
|
||||
repository.EventType(org.LabelPolicyLogoRemovedEventType),
|
||||
org.AggregateType,
|
||||
[]byte(`{"storeKey": "/path/to/logo.png"}`),
|
||||
), org.LabelPolicyLogoRemovedEventMapper),
|
||||
event: getEvent(
|
||||
testEvent(
|
||||
org.LabelPolicyLogoRemovedEventType,
|
||||
org.AggregateType,
|
||||
[]byte(`{"storeKey": "/path/to/logo.png"}`),
|
||||
), org.LabelPolicyLogoRemovedEventMapper),
|
||||
},
|
||||
reduce: (&labelPolicyProjection{}).reduceLogoRemoved,
|
||||
want: wantReduce{
|
||||
aggregateType: eventstore.AggregateType("org"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
aggregateType: eventstore.AggregateType("org"),
|
||||
sequence: 15,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -342,17 +341,17 @@ func TestLabelPolicyProjection_reduces(t *testing.T) {
|
||||
{
|
||||
name: "org reduceLogoRemoved dark",
|
||||
args: args{
|
||||
event: getEvent(testEvent(
|
||||
repository.EventType(org.LabelPolicyLogoDarkRemovedEventType),
|
||||
org.AggregateType,
|
||||
[]byte(`{"storeKey": "/path/to/logo.png"}`),
|
||||
), org.LabelPolicyLogoDarkRemovedEventMapper),
|
||||
event: getEvent(
|
||||
testEvent(
|
||||
org.LabelPolicyLogoDarkRemovedEventType,
|
||||
org.AggregateType,
|
||||
[]byte(`{"storeKey": "/path/to/logo.png"}`),
|
||||
), org.LabelPolicyLogoDarkRemovedEventMapper),
|
||||
},
|
||||
reduce: (&labelPolicyProjection{}).reduceLogoRemoved,
|
||||
want: wantReduce{
|
||||
aggregateType: eventstore.AggregateType("org"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
aggregateType: eventstore.AggregateType("org"),
|
||||
sequence: 15,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -373,17 +372,17 @@ func TestLabelPolicyProjection_reduces(t *testing.T) {
|
||||
{
|
||||
name: "org reduceIconRemoved light",
|
||||
args: args{
|
||||
event: getEvent(testEvent(
|
||||
repository.EventType(org.LabelPolicyIconRemovedEventType),
|
||||
org.AggregateType,
|
||||
[]byte(`{"storeKey": "/path/to/icon.png"}`),
|
||||
), org.LabelPolicyIconRemovedEventMapper),
|
||||
event: getEvent(
|
||||
testEvent(
|
||||
org.LabelPolicyIconRemovedEventType,
|
||||
org.AggregateType,
|
||||
[]byte(`{"storeKey": "/path/to/icon.png"}`),
|
||||
), org.LabelPolicyIconRemovedEventMapper),
|
||||
},
|
||||
reduce: (&labelPolicyProjection{}).reduceIconRemoved,
|
||||
want: wantReduce{
|
||||
aggregateType: eventstore.AggregateType("org"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
aggregateType: eventstore.AggregateType("org"),
|
||||
sequence: 15,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -404,17 +403,17 @@ func TestLabelPolicyProjection_reduces(t *testing.T) {
|
||||
{
|
||||
name: "org reduceIconRemoved dark",
|
||||
args: args{
|
||||
event: getEvent(testEvent(
|
||||
repository.EventType(org.LabelPolicyIconDarkRemovedEventType),
|
||||
org.AggregateType,
|
||||
[]byte(`{"storeKey": "/path/to/icon.png"}`),
|
||||
), org.LabelPolicyIconDarkRemovedEventMapper),
|
||||
event: getEvent(
|
||||
testEvent(
|
||||
org.LabelPolicyIconDarkRemovedEventType,
|
||||
org.AggregateType,
|
||||
[]byte(`{"storeKey": "/path/to/icon.png"}`),
|
||||
), org.LabelPolicyIconDarkRemovedEventMapper),
|
||||
},
|
||||
reduce: (&labelPolicyProjection{}).reduceIconRemoved,
|
||||
want: wantReduce{
|
||||
aggregateType: eventstore.AggregateType("org"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
aggregateType: eventstore.AggregateType("org"),
|
||||
sequence: 15,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -435,17 +434,17 @@ func TestLabelPolicyProjection_reduces(t *testing.T) {
|
||||
{
|
||||
name: "org reduceFontAdded",
|
||||
args: args{
|
||||
event: getEvent(testEvent(
|
||||
repository.EventType(org.LabelPolicyFontAddedEventType),
|
||||
org.AggregateType,
|
||||
[]byte(`{"storeKey": "/path/to/font.ttf"}`),
|
||||
), org.LabelPolicyFontAddedEventMapper),
|
||||
event: getEvent(
|
||||
testEvent(
|
||||
org.LabelPolicyFontAddedEventType,
|
||||
org.AggregateType,
|
||||
[]byte(`{"storeKey": "/path/to/font.ttf"}`),
|
||||
), org.LabelPolicyFontAddedEventMapper),
|
||||
},
|
||||
reduce: (&labelPolicyProjection{}).reduceFontAdded,
|
||||
want: wantReduce{
|
||||
aggregateType: eventstore.AggregateType("org"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
aggregateType: eventstore.AggregateType("org"),
|
||||
sequence: 15,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -466,17 +465,17 @@ func TestLabelPolicyProjection_reduces(t *testing.T) {
|
||||
{
|
||||
name: "org reduceFontRemoved",
|
||||
args: args{
|
||||
event: getEvent(testEvent(
|
||||
repository.EventType(org.LabelPolicyFontRemovedEventType),
|
||||
org.AggregateType,
|
||||
[]byte(`{"storeKey": "/path/to/font.ttf"}`),
|
||||
), org.LabelPolicyFontRemovedEventMapper),
|
||||
event: getEvent(
|
||||
testEvent(
|
||||
org.LabelPolicyFontRemovedEventType,
|
||||
org.AggregateType,
|
||||
[]byte(`{"storeKey": "/path/to/font.ttf"}`),
|
||||
), org.LabelPolicyFontRemovedEventMapper),
|
||||
},
|
||||
reduce: (&labelPolicyProjection{}).reduceFontRemoved,
|
||||
want: wantReduce{
|
||||
aggregateType: eventstore.AggregateType("org"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
aggregateType: eventstore.AggregateType("org"),
|
||||
sequence: 15,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -497,17 +496,17 @@ func TestLabelPolicyProjection_reduces(t *testing.T) {
|
||||
{
|
||||
name: "org reduceAssetsRemoved",
|
||||
args: args{
|
||||
event: getEvent(testEvent(
|
||||
repository.EventType(org.LabelPolicyAssetsRemovedEventType),
|
||||
org.AggregateType,
|
||||
nil,
|
||||
), org.LabelPolicyAssetsRemovedEventMapper),
|
||||
event: getEvent(
|
||||
testEvent(
|
||||
org.LabelPolicyAssetsRemovedEventType,
|
||||
org.AggregateType,
|
||||
nil,
|
||||
), org.LabelPolicyAssetsRemovedEventMapper),
|
||||
},
|
||||
reduce: (&labelPolicyProjection{}).reduceAssetsRemoved,
|
||||
want: wantReduce{
|
||||
aggregateType: eventstore.AggregateType("org"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
aggregateType: eventstore.AggregateType("org"),
|
||||
sequence: 15,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -532,17 +531,17 @@ func TestLabelPolicyProjection_reduces(t *testing.T) {
|
||||
{
|
||||
name: "instance reduceAdded",
|
||||
args: args{
|
||||
event: getEvent(testEvent(
|
||||
repository.EventType(instance.LabelPolicyAddedEventType),
|
||||
instance.AggregateType,
|
||||
[]byte(`{"backgroundColor": "#141735", "fontColor": "#ffffff", "primaryColor": "#5282c1", "warnColor": "#ff3b5b"}`),
|
||||
), instance.LabelPolicyAddedEventMapper),
|
||||
event: getEvent(
|
||||
testEvent(
|
||||
instance.LabelPolicyAddedEventType,
|
||||
instance.AggregateType,
|
||||
[]byte(`{"backgroundColor": "#141735", "fontColor": "#ffffff", "primaryColor": "#5282c1", "warnColor": "#ff3b5b"}`),
|
||||
), instance.LabelPolicyAddedEventMapper),
|
||||
},
|
||||
reduce: (&labelPolicyProjection{}).reduceAdded,
|
||||
want: wantReduce{
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -576,17 +575,17 @@ func TestLabelPolicyProjection_reduces(t *testing.T) {
|
||||
{
|
||||
name: "instance reduceChanged",
|
||||
args: args{
|
||||
event: getEvent(testEvent(
|
||||
repository.EventType(instance.LabelPolicyChangedEventType),
|
||||
instance.AggregateType,
|
||||
[]byte(`{"backgroundColor": "#141735", "fontColor": "#ffffff", "primaryColor": "#5282c1", "warnColor": "#ff3b5b", "primaryColorDark": "#ffffff","backgroundColorDark": "#ffffff", "warnColorDark": "#ffffff", "fontColorDark": "#ffffff", "hideLoginNameSuffix": true, "errorMsgPopup": true, "disableWatermark": true}`),
|
||||
), instance.LabelPolicyChangedEventMapper),
|
||||
event: getEvent(
|
||||
testEvent(
|
||||
instance.LabelPolicyChangedEventType,
|
||||
instance.AggregateType,
|
||||
[]byte(`{"backgroundColor": "#141735", "fontColor": "#ffffff", "primaryColor": "#5282c1", "warnColor": "#ff3b5b", "primaryColorDark": "#ffffff","backgroundColorDark": "#ffffff", "warnColorDark": "#ffffff", "fontColorDark": "#ffffff", "hideLoginNameSuffix": true, "errorMsgPopup": true, "disableWatermark": true}`),
|
||||
), instance.LabelPolicyChangedEventMapper),
|
||||
},
|
||||
reduce: (&labelPolicyProjection{}).reduceChanged,
|
||||
want: wantReduce{
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -617,17 +616,17 @@ func TestLabelPolicyProjection_reduces(t *testing.T) {
|
||||
{
|
||||
name: "instance reduceActivated",
|
||||
args: args{
|
||||
event: getEvent(testEvent(
|
||||
repository.EventType(instance.LabelPolicyActivatedEventType),
|
||||
instance.AggregateType,
|
||||
nil,
|
||||
), instance.LabelPolicyActivatedEventMapper),
|
||||
event: getEvent(
|
||||
testEvent(
|
||||
instance.LabelPolicyActivatedEventType,
|
||||
instance.AggregateType,
|
||||
nil,
|
||||
), instance.LabelPolicyActivatedEventMapper),
|
||||
},
|
||||
reduce: (&labelPolicyProjection{}).reduceActivated,
|
||||
want: wantReduce{
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -648,17 +647,17 @@ func TestLabelPolicyProjection_reduces(t *testing.T) {
|
||||
{
|
||||
name: "instance reduceLogoAdded light",
|
||||
args: args{
|
||||
event: getEvent(testEvent(
|
||||
repository.EventType(instance.LabelPolicyLogoAddedEventType),
|
||||
instance.AggregateType,
|
||||
[]byte(`{"storeKey": "/path/to/logo.png"}`),
|
||||
), instance.LabelPolicyLogoAddedEventMapper),
|
||||
event: getEvent(
|
||||
testEvent(
|
||||
instance.LabelPolicyLogoAddedEventType,
|
||||
instance.AggregateType,
|
||||
[]byte(`{"storeKey": "/path/to/logo.png"}`),
|
||||
), instance.LabelPolicyLogoAddedEventMapper),
|
||||
},
|
||||
reduce: (&labelPolicyProjection{}).reduceLogoAdded,
|
||||
want: wantReduce{
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -679,17 +678,17 @@ func TestLabelPolicyProjection_reduces(t *testing.T) {
|
||||
{
|
||||
name: "instance reduceLogoAdded dark",
|
||||
args: args{
|
||||
event: getEvent(testEvent(
|
||||
repository.EventType(instance.LabelPolicyLogoDarkAddedEventType),
|
||||
instance.AggregateType,
|
||||
[]byte(`{"storeKey": "/path/to/logo.png"}`),
|
||||
), instance.LabelPolicyLogoDarkAddedEventMapper),
|
||||
event: getEvent(
|
||||
testEvent(
|
||||
instance.LabelPolicyLogoDarkAddedEventType,
|
||||
instance.AggregateType,
|
||||
[]byte(`{"storeKey": "/path/to/logo.png"}`),
|
||||
), instance.LabelPolicyLogoDarkAddedEventMapper),
|
||||
},
|
||||
reduce: (&labelPolicyProjection{}).reduceLogoAdded,
|
||||
want: wantReduce{
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -710,17 +709,17 @@ func TestLabelPolicyProjection_reduces(t *testing.T) {
|
||||
{
|
||||
name: "instance reduceIconAdded light",
|
||||
args: args{
|
||||
event: getEvent(testEvent(
|
||||
repository.EventType(instance.LabelPolicyIconAddedEventType),
|
||||
instance.AggregateType,
|
||||
[]byte(`{"storeKey": "/path/to/icon.png"}`),
|
||||
), instance.LabelPolicyIconAddedEventMapper),
|
||||
event: getEvent(
|
||||
testEvent(
|
||||
instance.LabelPolicyIconAddedEventType,
|
||||
instance.AggregateType,
|
||||
[]byte(`{"storeKey": "/path/to/icon.png"}`),
|
||||
), instance.LabelPolicyIconAddedEventMapper),
|
||||
},
|
||||
reduce: (&labelPolicyProjection{}).reduceIconAdded,
|
||||
want: wantReduce{
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -741,17 +740,17 @@ func TestLabelPolicyProjection_reduces(t *testing.T) {
|
||||
{
|
||||
name: "instance reduceIconAdded dark",
|
||||
args: args{
|
||||
event: getEvent(testEvent(
|
||||
repository.EventType(instance.LabelPolicyIconDarkAddedEventType),
|
||||
instance.AggregateType,
|
||||
[]byte(`{"storeKey": "/path/to/icon.png"}`),
|
||||
), instance.LabelPolicyIconDarkAddedEventMapper),
|
||||
event: getEvent(
|
||||
testEvent(
|
||||
instance.LabelPolicyIconDarkAddedEventType,
|
||||
instance.AggregateType,
|
||||
[]byte(`{"storeKey": "/path/to/icon.png"}`),
|
||||
), instance.LabelPolicyIconDarkAddedEventMapper),
|
||||
},
|
||||
reduce: (&labelPolicyProjection{}).reduceIconAdded,
|
||||
want: wantReduce{
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -772,17 +771,17 @@ func TestLabelPolicyProjection_reduces(t *testing.T) {
|
||||
{
|
||||
name: "instance reduceLogoRemoved light",
|
||||
args: args{
|
||||
event: getEvent(testEvent(
|
||||
repository.EventType(instance.LabelPolicyLogoRemovedEventType),
|
||||
instance.AggregateType,
|
||||
[]byte(`{"storeKey": "/path/to/logo.png"}`),
|
||||
), instance.LabelPolicyLogoRemovedEventMapper),
|
||||
event: getEvent(
|
||||
testEvent(
|
||||
instance.LabelPolicyLogoRemovedEventType,
|
||||
instance.AggregateType,
|
||||
[]byte(`{"storeKey": "/path/to/logo.png"}`),
|
||||
), instance.LabelPolicyLogoRemovedEventMapper),
|
||||
},
|
||||
reduce: (&labelPolicyProjection{}).reduceLogoRemoved,
|
||||
want: wantReduce{
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -803,17 +802,17 @@ func TestLabelPolicyProjection_reduces(t *testing.T) {
|
||||
{
|
||||
name: "instance reduceLogoRemoved dark",
|
||||
args: args{
|
||||
event: getEvent(testEvent(
|
||||
repository.EventType(instance.LabelPolicyLogoDarkRemovedEventType),
|
||||
instance.AggregateType,
|
||||
[]byte(`{"storeKey": "/path/to/logo.png"}`),
|
||||
), instance.LabelPolicyLogoDarkRemovedEventMapper),
|
||||
event: getEvent(
|
||||
testEvent(
|
||||
instance.LabelPolicyLogoDarkRemovedEventType,
|
||||
instance.AggregateType,
|
||||
[]byte(`{"storeKey": "/path/to/logo.png"}`),
|
||||
), instance.LabelPolicyLogoDarkRemovedEventMapper),
|
||||
},
|
||||
reduce: (&labelPolicyProjection{}).reduceLogoRemoved,
|
||||
want: wantReduce{
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -834,17 +833,17 @@ func TestLabelPolicyProjection_reduces(t *testing.T) {
|
||||
{
|
||||
name: "instance reduceIconRemoved light",
|
||||
args: args{
|
||||
event: getEvent(testEvent(
|
||||
repository.EventType(instance.LabelPolicyIconRemovedEventType),
|
||||
instance.AggregateType,
|
||||
[]byte(`{"storeKey": "/path/to/icon.png"}`),
|
||||
), instance.LabelPolicyIconRemovedEventMapper),
|
||||
event: getEvent(
|
||||
testEvent(
|
||||
instance.LabelPolicyIconRemovedEventType,
|
||||
instance.AggregateType,
|
||||
[]byte(`{"storeKey": "/path/to/icon.png"}`),
|
||||
), instance.LabelPolicyIconRemovedEventMapper),
|
||||
},
|
||||
reduce: (&labelPolicyProjection{}).reduceIconRemoved,
|
||||
want: wantReduce{
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -865,17 +864,17 @@ func TestLabelPolicyProjection_reduces(t *testing.T) {
|
||||
{
|
||||
name: "instance reduceIconRemoved dark",
|
||||
args: args{
|
||||
event: getEvent(testEvent(
|
||||
repository.EventType(instance.LabelPolicyIconDarkRemovedEventType),
|
||||
instance.AggregateType,
|
||||
[]byte(`{"storeKey": "/path/to/icon.png"}`),
|
||||
), instance.LabelPolicyIconDarkRemovedEventMapper),
|
||||
event: getEvent(
|
||||
testEvent(
|
||||
instance.LabelPolicyIconDarkRemovedEventType,
|
||||
instance.AggregateType,
|
||||
[]byte(`{"storeKey": "/path/to/icon.png"}`),
|
||||
), instance.LabelPolicyIconDarkRemovedEventMapper),
|
||||
},
|
||||
reduce: (&labelPolicyProjection{}).reduceIconRemoved,
|
||||
want: wantReduce{
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -896,17 +895,17 @@ func TestLabelPolicyProjection_reduces(t *testing.T) {
|
||||
{
|
||||
name: "instance reduceFontAdded",
|
||||
args: args{
|
||||
event: getEvent(testEvent(
|
||||
repository.EventType(instance.LabelPolicyFontAddedEventType),
|
||||
instance.AggregateType,
|
||||
[]byte(`{"storeKey": "/path/to/font.ttf"}`),
|
||||
), instance.LabelPolicyFontAddedEventMapper),
|
||||
event: getEvent(
|
||||
testEvent(
|
||||
instance.LabelPolicyFontAddedEventType,
|
||||
instance.AggregateType,
|
||||
[]byte(`{"storeKey": "/path/to/font.ttf"}`),
|
||||
), instance.LabelPolicyFontAddedEventMapper),
|
||||
},
|
||||
reduce: (&labelPolicyProjection{}).reduceFontAdded,
|
||||
want: wantReduce{
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -927,17 +926,17 @@ func TestLabelPolicyProjection_reduces(t *testing.T) {
|
||||
{
|
||||
name: "instance reduceFontRemoved",
|
||||
args: args{
|
||||
event: getEvent(testEvent(
|
||||
repository.EventType(instance.LabelPolicyFontRemovedEventType),
|
||||
instance.AggregateType,
|
||||
[]byte(`{"storeKey": "/path/to/font.ttf"}`),
|
||||
), instance.LabelPolicyFontRemovedEventMapper),
|
||||
event: getEvent(
|
||||
testEvent(
|
||||
instance.LabelPolicyFontRemovedEventType,
|
||||
instance.AggregateType,
|
||||
[]byte(`{"storeKey": "/path/to/font.ttf"}`),
|
||||
), instance.LabelPolicyFontRemovedEventMapper),
|
||||
},
|
||||
reduce: (&labelPolicyProjection{}).reduceFontRemoved,
|
||||
want: wantReduce{
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -958,17 +957,17 @@ func TestLabelPolicyProjection_reduces(t *testing.T) {
|
||||
{
|
||||
name: "instance reduceAssetsRemoved",
|
||||
args: args{
|
||||
event: getEvent(testEvent(
|
||||
repository.EventType(instance.LabelPolicyAssetsRemovedEventType),
|
||||
instance.AggregateType,
|
||||
nil,
|
||||
), instance.LabelPolicyAssetsRemovedEventMapper),
|
||||
event: getEvent(
|
||||
testEvent(
|
||||
instance.LabelPolicyAssetsRemovedEventType,
|
||||
instance.AggregateType,
|
||||
nil,
|
||||
), instance.LabelPolicyAssetsRemovedEventMapper),
|
||||
},
|
||||
reduce: (&labelPolicyProjection{}).reduceAssetsRemoved,
|
||||
want: wantReduce{
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -994,16 +993,16 @@ func TestLabelPolicyProjection_reduces(t *testing.T) {
|
||||
name: "org.reduceOwnerRemoved",
|
||||
reduce: (&labelPolicyProjection{}).reduceOwnerRemoved,
|
||||
args: args{
|
||||
event: getEvent(testEvent(
|
||||
repository.EventType(org.OrgRemovedEventType),
|
||||
org.AggregateType,
|
||||
nil,
|
||||
), org.OrgRemovedEventMapper),
|
||||
event: getEvent(
|
||||
testEvent(
|
||||
org.OrgRemovedEventType,
|
||||
org.AggregateType,
|
||||
nil,
|
||||
), org.OrgRemovedEventMapper),
|
||||
},
|
||||
want: wantReduce{
|
||||
aggregateType: eventstore.AggregateType("org"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
aggregateType: eventstore.AggregateType("org"),
|
||||
sequence: 15,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
|
Reference in New Issue
Block a user