Skip to content

Remove marginalia traces in query matcher

What does this MR do?

Remove marginalia traces when diffing for extra queries on exceed_query_limit matcher. The additional unique correlation_id has resulted in a complete output of all executed queries, instead of just the ones that are different.

This also help to reduce unnecessary noises when scanning through the failure messages.

Before

Expected a maximum of 33 queries, got 37:

Extra queries:

[1] SELECT "users".* FROM "users" WHERE "users"."id" = 1 ORDER BY "users"."id" ASC LIMIT 1 /*application:test,controller:audit_events,action:index,correlation_id:f1b98094-ff7e-4967-969e-8fd4948dfbae*/

[1] SELECT 1 AS one FROM "identities" WHERE "identities"."user_id" = 1 AND (provider = 'ultraauth' AND extern_uid IS NOT NULL) LIMIT 1 /*application:test,controller:audit_events,action:index,correlation_id:f1b98094-ff7e-4967-969e-8fd4948dfbae*/

[1] SELECT 1 AS one FROM "identities" WHERE "identities"."user_id" = 1 AND (provider LIKE 'ldap%' AND extern_uid IS NOT NULL) LIMIT 1 /*application:test,controller:audit_events,action:index,correlation_id:f1b98094-ff7e-4967-969e-8fd4948dfbae*/

[1] SELECT "user_preferences".* FROM "user_preferences" WHERE "user_preferences"."user_id" = 1 LIMIT 1 /*application:test,controller:audit_events,action:index,correlation_id:f1b98094-ff7e-4967-969e-8fd4948dfbae*/

... 33 more...

After

Expected a maximum of 33 queries, got 37:
     
Extra queries:
     
[1] SELECT "users".* FROM "users" WHERE "users"."id" = 1 ORDER BY "users"."id" ASC LIMIT 1
     
[1] SELECT "user_preferences".* FROM "user_preferences" WHERE "user_preferences"."user_id" = 1 LIMIT 1
     
[1] SELECT "users".* FROM "users" WHERE "users"."id" = 4 ORDER BY "users"."id" ASC LIMIT 1000
     
[1] SELECT "users".* FROM "users" WHERE "users"."id" IN (4, 3) ORDER BY "users"."id" ASC LIMIT 1000

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • [-] Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • [-] Security reports checked/validated by a reviewer from the AppSec team
Edited by Tan Le

Merge request reports