mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 00:57:33 +00:00
feat: instance remove (#4345)
* feat(instance): add remove instance event with projections cleanup * fix(instance): corrected used id to clean up projections * fix merge * fix: correct unit test projection names * fix: current sequence of lists and query for ensuring keypair based projections Co-authored-by: Livio Spring <livio.a@gmail.com> Co-authored-by: Fabi <38692350+hifabienne@users.noreply.github.com>
This commit is contained in:
@@ -43,7 +43,6 @@ func TestIDPProjection_reduces(t *testing.T) {
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
projection: IDPTable,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -85,7 +84,6 @@ func TestIDPProjection_reduces(t *testing.T) {
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
projection: IDPTable,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -120,7 +118,6 @@ func TestIDPProjection_reduces(t *testing.T) {
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
projection: IDPTable,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -153,7 +150,6 @@ func TestIDPProjection_reduces(t *testing.T) {
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
projection: IDPTable,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -186,7 +182,6 @@ func TestIDPProjection_reduces(t *testing.T) {
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
projection: IDPTable,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -200,6 +195,32 @@ func TestIDPProjection_reduces(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "instance.reduceInstanceRemoved",
|
||||
args: args{
|
||||
event: getEvent(testEvent(
|
||||
repository.EventType(instance.InstanceRemovedEventType),
|
||||
instance.AggregateType,
|
||||
[]byte(`{"name": "Name"}`),
|
||||
), instance.InstanceRemovedEventMapper),
|
||||
},
|
||||
reduce: reduceInstanceRemovedHelper(IDPInstanceIDCol),
|
||||
want: wantReduce{
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
expectedStmt: "DELETE FROM projections.idps2 WHERE (instance_id = $1)",
|
||||
expectedArgs: []interface{}{
|
||||
"agg-id",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "instance.reduceOIDCConfigAdded",
|
||||
args: args{
|
||||
@@ -228,7 +249,6 @@ func TestIDPProjection_reduces(t *testing.T) {
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
projection: IDPTable,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -288,7 +308,6 @@ func TestIDPProjection_reduces(t *testing.T) {
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
projection: IDPTable,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -333,7 +352,6 @@ func TestIDPProjection_reduces(t *testing.T) {
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
projection: IDPTable,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{},
|
||||
},
|
||||
@@ -359,7 +377,6 @@ func TestIDPProjection_reduces(t *testing.T) {
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
projection: IDPTable,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -407,7 +424,6 @@ func TestIDPProjection_reduces(t *testing.T) {
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
projection: IDPTable,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -448,7 +464,6 @@ func TestIDPProjection_reduces(t *testing.T) {
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
projection: IDPTable,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{},
|
||||
},
|
||||
@@ -474,7 +489,6 @@ func TestIDPProjection_reduces(t *testing.T) {
|
||||
aggregateType: eventstore.AggregateType("org"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
projection: IDPTable,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -516,7 +530,6 @@ func TestIDPProjection_reduces(t *testing.T) {
|
||||
aggregateType: eventstore.AggregateType("org"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
projection: IDPTable,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -551,7 +564,6 @@ func TestIDPProjection_reduces(t *testing.T) {
|
||||
aggregateType: eventstore.AggregateType("org"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
projection: IDPTable,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -584,7 +596,6 @@ func TestIDPProjection_reduces(t *testing.T) {
|
||||
aggregateType: eventstore.AggregateType("org"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
projection: IDPTable,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -617,7 +628,6 @@ func TestIDPProjection_reduces(t *testing.T) {
|
||||
aggregateType: eventstore.AggregateType("org"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
projection: IDPTable,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -659,7 +669,6 @@ func TestIDPProjection_reduces(t *testing.T) {
|
||||
aggregateType: eventstore.AggregateType("org"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
projection: IDPTable,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -719,7 +728,6 @@ func TestIDPProjection_reduces(t *testing.T) {
|
||||
aggregateType: eventstore.AggregateType("org"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
projection: IDPTable,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -764,7 +772,6 @@ func TestIDPProjection_reduces(t *testing.T) {
|
||||
aggregateType: eventstore.AggregateType("org"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
projection: IDPTable,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{},
|
||||
},
|
||||
@@ -790,7 +797,6 @@ func TestIDPProjection_reduces(t *testing.T) {
|
||||
aggregateType: eventstore.AggregateType("org"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
projection: IDPTable,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -838,7 +844,6 @@ func TestIDPProjection_reduces(t *testing.T) {
|
||||
aggregateType: eventstore.AggregateType("org"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
projection: IDPTable,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -879,7 +884,6 @@ func TestIDPProjection_reduces(t *testing.T) {
|
||||
aggregateType: eventstore.AggregateType("org"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
projection: IDPTable,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{},
|
||||
},
|
||||
@@ -896,7 +900,7 @@ func TestIDPProjection_reduces(t *testing.T) {
|
||||
|
||||
event = tt.args.event(t)
|
||||
got, err = tt.reduce(event)
|
||||
assertReduce(t, got, err, tt.want)
|
||||
assertReduce(t, got, err, IDPTable, tt.want)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user