mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 10:47:37 +00:00
Add validation tests for query optimizations
Co-authored-by: muhlemmer <5411563+muhlemmer@users.noreply.github.com>
This commit is contained in:
@@ -102,3 +102,19 @@ func TestQueries_ActiveIntrospectionClientByID(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// TestIntrospectionQueryOptimizations validates that the optimized query
|
||||
// has the expected performance characteristics
|
||||
func TestIntrospectionQueryOptimizations(t *testing.T) {
|
||||
// Test that UNION ALL is used instead of UNION
|
||||
assert.Contains(t, introspectionClientByIDQuery, "union all", "Expected 'union all' in optimized query")
|
||||
|
||||
// Test that aliases are used consistently
|
||||
assert.Contains(t, introspectionClientByIDQuery, "from config c", "Expected consistent alias usage 'config c'")
|
||||
|
||||
// Test that keys CTE is simplified
|
||||
assert.Contains(t, introspectionClientByIDQuery, "$2::text as client_id", "Expected simplified keys CTE with $2::text casting")
|
||||
|
||||
// Test that conditional join logic is present
|
||||
assert.Contains(t, introspectionClientByIDQuery, "and $3 = true", "Expected conditional join logic 'and $3 = true'")
|
||||
}
|
||||
|
Reference in New Issue
Block a user