Skip to content

Prevent pre-enforcement and threshold banners both displaying

What does this MR do and why?

This implements https://gitlab.com/gitlab-org/gitlab/-/issues/432082

Screenshots or screen recordings

Before After After - over limit
80__usage_before 80__usage_after over_usage_after

How to set up and validate locally

Use these commands in rails console:

  1. Gitlab::CurrentSettings.update!(automatic_purchased_storage_allocation: true)
  2. Gitlab::CurrentSettings.update!(enforce_namespace_storage_limit: true)
  3. Plan.free.actual_limits.update!(notification_limit: 5*1024)
  4. Plan.free.actual_limits.update!(enforcement_limit: 10*1024)
  5. Plan.free.actual_limits.update!(storage_size_limit: 5*1024)
  6. Project.find(29).statistics.update(repository_size: 8.gigabytes)
    1. Sidekiq.redis(&:flushdb)
    2. Namespaces::ScheduleAggregationWorker.perform_sync(89)
    3. Namespaces::RootStatisticsWorker.perform_sync(89)
  7. Feature.enable(:namespace_storage_limit_show_preenforcement_banner, Group.find(89))
  8. Feature.enable(:namespace_storage_limit, Group.find(89))

Check the following scenarios:

  1. Namespace with 8.gigabytes of used storage: only show pre-enforcement banner
  2. Namespace with 12.gigabytes of used storage: only show enforcement banner
  3. All the actual_limits set to 5*1024
  4. Namespace with 8.gigabytes of used storage: show enforcement banner
  5. Namespace with 4.gigabytes of used storage: shows threshold banner

MR acceptance checklist

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

Edited by Kos Palchyk

Merge request reports