Skip to content

Fix flaky tests in git rate-limiting services

What does this MR do and why?

Our suspicion is that this flakiness was being caused by the method check_admins_alerted. More details: !95468 (comment 1113594209).

Hence, I have:

  • Moved @admins_alerted to the constructor with attr_reader access
  • Mocked throttled? in the specs for the services since we already have a complete test-suite for the :Gitlab::ApplicationRateLimiter.throttled? method.

How to set up and validate locally

bin/rspec ./ee/spec/services/users/abuse/git_abuse/namespace_throttle_service_spec.rb
bin/rspec ./ee/spec/services/users/abuse/excessive_projects_download_ban_service_spec.rb.rb

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #370812 (closed)

Edited by Hinam Mehra

Merge request reports

Loading