mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 07:37:31 +00:00
fix: correct handling of removed targets (#9824)
# Which Problems Are Solved
In Actions v2, if a target is removed, which is still used in an
execution, the target is still listed when list executions.
# How the Problems Are Solved
Removed targets are now also removed from the executions.
# Additional Changes
To be sure the list executions include a check if the target is still
existing.
# Additional Context
None
Co-authored-by: Livio Spring <livio.a@gmail.com>
(cherry picked from commit a05f7ce3fc
)
This commit is contained in:

committed by
Livio Spring

parent
8bd7414241
commit
bd75b8c9bd
@@ -7,6 +7,7 @@ import (
|
||||
"github.com/zitadel/zitadel/internal/eventstore/handler/v2"
|
||||
exec "github.com/zitadel/zitadel/internal/repository/execution"
|
||||
"github.com/zitadel/zitadel/internal/repository/instance"
|
||||
"github.com/zitadel/zitadel/internal/repository/target"
|
||||
"github.com/zitadel/zitadel/internal/zerrors"
|
||||
)
|
||||
|
||||
@@ -79,6 +80,35 @@ func TestExecutionProjection_reduces(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "reduceTargetRemoved",
|
||||
args: args{
|
||||
event: getEvent(
|
||||
testEvent(
|
||||
target.RemovedEventType,
|
||||
target.AggregateType,
|
||||
[]byte(`{}`),
|
||||
),
|
||||
eventstore.GenericEventMapper[target.RemovedEvent],
|
||||
),
|
||||
},
|
||||
reduce: (&executionProjection{}).reduceTargetRemoved,
|
||||
want: wantReduce{
|
||||
aggregateType: eventstore.AggregateType("target"),
|
||||
sequence: 15,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
expectedStmt: "DELETE FROM projections.executions1_targets WHERE (instance_id = $1) AND (target_id = $2)",
|
||||
expectedArgs: []interface{}{
|
||||
"instance-id",
|
||||
"agg-id",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "reduceExecutionRemoved",
|
||||
args: args{
|
||||
|
Reference in New Issue
Block a user