Check every membership in one search visibility example

What does this MR do and why?

Cuts the search visibility specs by 63 minutes of rspec-ee unit time per pipeline (124 → 61 minutes, −51%), and about 7.6 minutes off each rspec-ee unit pg17 es9 job. Together with !267944 (merged), the saving is 100 to 114 minutes, from 161–175 minutes on master.

Rows of a permission table that share a project or group setting only differ in membership, admin mode and expected count, yet each row set up and indexed the same data again. For example, the milestones table has 183 rows but 27 settings. This MR checks every membership for a setting in one example:

  • Adds access_cases_by_setting in PermissionTableHelpers, included by the policy table shared contexts. It groups a table into one row per setting with an access_cases list. The tables don't change.
  • search respects visibility checks every case in one example with :aggregate_failures. Failures name the access path, membership and admin mode.
  • Converts 44 tables in 35 files. The two on issues notes contexts keep one row per example, because their test data depends on the row's user.
  • Cases with an admin in admin mode use a separate admin, because enable_admin_mode! stays stubbed for the rest of an example.
CI and local results

The master times in the test result summary don't include !267944 (merged) yet, so its per-file savings cover both MRs.

master After !267944 (merged) This MR
35 files, rspec-ee unit pg17 161–175 min 124 min 61 min
rspec-ee unit pg17 es9, 9 jobs 303 min 235 min
rspec-ee unit pg17 es9, median job 33.6 min 26.0 min

The es9 jobs run in the nightly master pipeline and in merge requests with pipeline:run-search-tests or group::global search that change backend code.

Locally, project_service_milestones_visibility_spec.rb goes from 251 s to 100 s (183 → 27 examples), and project_service_blobs_visibility_spec.rb takes 116 s (118 → 22 examples).

All 35 files pass locally: 514 examples, 0 failures. On the milestones spec, always looking up the admin user fails 14 of 27 examples, and so does using one admin with and without admin mode.

References

Screenshots or screen recordings

Not applicable: spec-only change.

How to set up and validate locally

Not applicable: spec-only change with no behavior to check manually.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Heinrich Lee Yu

Merge request reports

Loading
Loading