Add labkit rack rate-limit request-spec coverage

Summary

Stacked on the rename MR (Rename labkit_rack_rate_limit_shadow_spec files (!251962 - merged)). Adds the request-spec coverage Re-home Rack::Attack request-spec coverage onto... (gitlab-com/gl-infra/production-engineering#29542 - closed) requires before its follow-up issue can safely delete the Rack::Attack throttle specs.

Closes the scope agreed with @reprazent in the issue thread:

  • Per-throttle admin setting toggles - every throttle in ThrottleRegistry.meta (CE and EE), both enabled-and-blocking and disabled-and-never-blocking.
  • RateLimit-* header assertions - full header set (not just RateLimit-Name) on every 429, via RackAttackSpecHelpers#expect_rejection.
  • GITLAB_THROTTLE_DRY_RUN - including the legacy throttle_unauthenticated alias.
  • GITLAB_THROTTLE_BYPASS_HEADER - representative unauthenticated + authenticated throttles.
  • GITLAB_THROTTLE_USER_ALLOWLIST - representative authenticated throttles, plus the existing mutual-exemption case.

Table-based throughout (per the testing guide), grouped into four throttle families (general web/API, specialized paths, git, protected paths) sharing two shared_examples to avoid repeating the same assertions six times over.

Does not touch spec/requests/rack_attack_global_spec.rb, spec/support/shared_examples/requests/rack_attack_shared_examples.rb, or ee/spec/requests/rack_attack_spec.rb - out of scope per the issue, removed separately by the follow-up issue once this coverage is in place.

Test plan

  • bundle exec rspec spec/requests/labkit_rack_rate_limit_spec.rb ee/spec/requests/labkit_rack_rate_limit_spec.rb - 61 examples, 0 failures
  • bundle exec rubocop on both changed files - 0 offenses

Related to Re-home Rack::Attack request-spec coverage onto... (gitlab-com/gl-infra/production-engineering#29542 - closed)

Edited by Hardik Gala

Merge request reports

Loading
Loading