perf: remove owner removed columns from projections for oidc (#6925)

* fix: remove owner removed columns from login names projection

* fix: remove owner removed columns from flow projection

* fix: remove owner removed columns from project, projectgrant and member projections

* fix: correct unit tests for session projection

* fix: correct unit tests for session projection
This commit is contained in:
Stefan Benz
2023-11-20 16:21:08 +01:00
committed by GitHub
parent 3bed5f50a8
commit 0ec7a74877
65 changed files with 358 additions and 654 deletions

View File

@@ -72,22 +72,19 @@ func TestProjectGrantMemberProjection_reduces(t *testing.T) {
executer: &testExecuter{
executions: []execution{
{
expectedStmt: "INSERT INTO projections.project_grant_members3 (user_id, user_resource_owner, user_owner_removed, roles, creation_date, change_date, sequence, resource_owner, instance_id, owner_removed, project_id, grant_id, granted_org, granted_org_removed) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14)",
expectedStmt: "INSERT INTO projections.project_grant_members4 (user_id, user_resource_owner, roles, creation_date, change_date, sequence, resource_owner, instance_id, project_id, grant_id, granted_org) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)",
expectedArgs: []interface{}{
"user-id",
"org1",
false,
database.TextArray[string]{"role"},
anyArg{},
anyArg{},
uint64(15),
"ro-id",
"instance-id",
false,
"agg-id",
"grant-id",
"org3",
false,
},
},
},
@@ -115,7 +112,7 @@ func TestProjectGrantMemberProjection_reduces(t *testing.T) {
executer: &testExecuter{
executions: []execution{
{
expectedStmt: "UPDATE projections.project_grant_members3 SET (roles, change_date, sequence) = ($1, $2, $3) WHERE (instance_id = $4) AND (user_id = $5) AND (project_id = $6) AND (grant_id = $7)",
expectedStmt: "UPDATE projections.project_grant_members4 SET (roles, change_date, sequence) = ($1, $2, $3) WHERE (instance_id = $4) AND (user_id = $5) AND (project_id = $6) AND (grant_id = $7)",
expectedArgs: []interface{}{
database.TextArray[string]{"role", "changed"},
anyArg{},
@@ -150,7 +147,7 @@ func TestProjectGrantMemberProjection_reduces(t *testing.T) {
executer: &testExecuter{
executions: []execution{
{
expectedStmt: "DELETE FROM projections.project_grant_members3 WHERE (instance_id = $1) AND (user_id = $2) AND (project_id = $3) AND (grant_id = $4)",
expectedStmt: "DELETE FROM projections.project_grant_members4 WHERE (instance_id = $1) AND (user_id = $2) AND (project_id = $3) AND (grant_id = $4)",
expectedArgs: []interface{}{
"instance-id",
"user-id",
@@ -182,7 +179,7 @@ func TestProjectGrantMemberProjection_reduces(t *testing.T) {
executer: &testExecuter{
executions: []execution{
{
expectedStmt: "DELETE FROM projections.project_grant_members3 WHERE (instance_id = $1) AND (user_id = $2) AND (project_id = $3) AND (grant_id = $4)",
expectedStmt: "DELETE FROM projections.project_grant_members4 WHERE (instance_id = $1) AND (user_id = $2) AND (project_id = $3) AND (grant_id = $4)",
expectedArgs: []interface{}{
"instance-id",
"user-id",
@@ -211,7 +208,7 @@ func TestProjectGrantMemberProjection_reduces(t *testing.T) {
executer: &testExecuter{
executions: []execution{
{
expectedStmt: "DELETE FROM projections.project_grant_members3 WHERE (instance_id = $1) AND (user_id = $2)",
expectedStmt: "DELETE FROM projections.project_grant_members4 WHERE (instance_id = $1) AND (user_id = $2)",
expectedArgs: []interface{}{
"instance-id",
"agg-id",
@@ -238,7 +235,7 @@ func TestProjectGrantMemberProjection_reduces(t *testing.T) {
executer: &testExecuter{
executions: []execution{
{
expectedStmt: "DELETE FROM projections.project_grant_members3 WHERE (instance_id = $1) AND (project_id = $2)",
expectedStmt: "DELETE FROM projections.project_grant_members4 WHERE (instance_id = $1) AND (project_id = $2)",
expectedArgs: []interface{}{
"instance-id",
"agg-id",
@@ -264,7 +261,7 @@ func TestProjectGrantMemberProjection_reduces(t *testing.T) {
executer: &testExecuter{
executions: []execution{
{
expectedStmt: "DELETE FROM projections.project_grant_members3 WHERE (instance_id = $1)",
expectedStmt: "DELETE FROM projections.project_grant_members4 WHERE (instance_id = $1)",
expectedArgs: []interface{}{
"agg-id",
},
@@ -290,7 +287,7 @@ func TestProjectGrantMemberProjection_reduces(t *testing.T) {
executer: &testExecuter{
executions: []execution{
{
expectedStmt: "DELETE FROM projections.project_grant_members3 WHERE (instance_id = $1) AND (grant_id = $2) AND (project_id = $3)",
expectedStmt: "DELETE FROM projections.project_grant_members4 WHERE (instance_id = $1) AND (grant_id = $2) AND (project_id = $3)",
expectedArgs: []interface{}{
"instance-id",
"grant-id",
@@ -318,21 +315,21 @@ func TestProjectGrantMemberProjection_reduces(t *testing.T) {
executer: &testExecuter{
executions: []execution{
{
expectedStmt: "DELETE FROM projections.project_grant_members3 WHERE (instance_id = $1) AND (resource_owner = $2)",
expectedStmt: "DELETE FROM projections.project_grant_members4 WHERE (instance_id = $1) AND (resource_owner = $2)",
expectedArgs: []interface{}{
"instance-id",
"agg-id",
},
},
{
expectedStmt: "DELETE FROM projections.project_grant_members3 WHERE (instance_id = $1) AND (user_resource_owner = $2)",
expectedStmt: "DELETE FROM projections.project_grant_members4 WHERE (instance_id = $1) AND (user_resource_owner = $2)",
expectedArgs: []interface{}{
"instance-id",
"agg-id",
},
},
{
expectedStmt: "DELETE FROM projections.project_grant_members3 WHERE (instance_id = $1) AND (granted_org = $2)",
expectedStmt: "DELETE FROM projections.project_grant_members4 WHERE (instance_id = $1) AND (granted_org = $2)",
expectedArgs: []interface{}{
"instance-id",
"agg-id",