Skip to content

Refactor RootStorageSize date constants

Vijay Hawoldar requested to merge vij-storage-constant-refactor into master

What does this MR do and why?

In order to allow us to manually test date dependant logic within Namespaces::RootStorageSize, this MR allows us to bypass the date comparisons via a feature flag that we can enable for our test groups.

Refs https://gitlab.com/gitlab-org/gitlab/-/issues/340887#note_937881408

These dates will eventually be set to more logical values during rollout but until then we need to be able to test any feature development we do. This MR will enable us to do that on staging and production environments.

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Ensure you're GDK instance is running in SaaS mode:
      export GITLAB_SIMULATE_SAAS=1
  2. Create a new root Group then look it up in a Rails console:
      group = Group.last
  3. Enable the prerequisite feature flag:
      Feature.enable(:enforce_storage_limit_for_free, group)
  4. Confirm existing behaviour:
      rss = Namespace::RootStorageSize.new(group)
    
      rss.enforce_limit?
    
      => false
  5. Enable the new feature flag
      Feature.enable(:namespace_storage_limit_bypass_date_check, group)
  6. Confirm the new behaviour:
      rss.enforce_limit?
    
      => true
  7. Create another Group (or use an existing one) and confirm the method still returns false for that group:
      other_group = Group.find(x)
    
      Feature.enable(:enforce_storage_limit_for_free, other_group)
      
      rss = Namespace::RootStorageSize.new(group)
      rss.enforce_limit?
    
      => false

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 Vijay Hawoldar

Merge request reports