Commit a9bc2aa9 authored by Doug Stull's avatar Doug Stull

Merge branch 'issue_227586_ff_for_storage_limits' into 'master'

Created ff for enabling namespace storage limit

See merge request gitlab-org/gitlab!82704
parents bbc989ca 5393d8c3
......@@ -40,10 +40,12 @@ module EE
def enforce_limit?
return false if Date.current < ENFORCEMENT_DATE
return false if root_namespace.opensource_plan?
return false if gitlab_subscription.start_date < EFFECTIVE_DATE
return true unless gitlab_subscription&.has_a_paid_hosted_plan?
return ::Feature.enabled?(:enforce_storage_limit_for_paid, root_namespace, default_enabled: :yaml) if root_namespace.paid?
gitlab_subscription.start_date >= EFFECTIVE_DATE
::Feature.enabled?(:enforce_storage_limit_for_free, root_namespace, default_enabled: :yaml)
end
private
......
---
name: enforce_storage_limit_for_free
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/82704
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/356767
milestone: '14.10'
type: development
group: group::utilization
default_enabled: false
---
name: enforce_storage_limit_for_paid
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/82704
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/356768
milestone: '14.10'
type: development
group: group::utilization
default_enabled: false
......@@ -173,28 +173,52 @@ RSpec.describe EE::Namespace::RootStorageSize, :saas do
it { is_expected.to eq(true) }
end
context 'when subscription is for a free plan' do
context 'when subscription is for opensource plan' do
let!(:subscription) do
create(:gitlab_subscription, namespace: namespace, hosted_plan: create(:free_plan))
create(:gitlab_subscription, namespace: namespace, hosted_plan: create(:opensource_plan))
end
it { is_expected.to eq(true) }
it { is_expected.to eq(false) }
end
context 'when subscription is for a paid plan' do
context 'when subscription start date is before effective date' do
let(:start_date) { described_class::EFFECTIVE_DATE - 1.day }
before do
allow(subscription).to receive(:start_date).and_return(start_date)
end
context 'when subscription start date is before effective date' do
let(:start_date) { described_class::EFFECTIVE_DATE - 1.day }
it { is_expected.to eq(false) }
end
context 'when subscription is for a free plan' do
let!(:subscription) do
create(:gitlab_subscription, namespace: namespace, hosted_plan: create(:free_plan))
end
context 'when enforce_storage_limit_for_free is disabled' do
before do
stub_feature_flags(enforce_storage_limit_for_free: false)
end
it { is_expected.to eq(false) }
end
context 'when subscription start date is on or after effective date' do
let(:start_date) { described_class::EFFECTIVE_DATE }
it { is_expected.to eq(true) }
end
end
context 'when subscription is for a paid plan' do
context 'when enforce_storage_limit_for_paid is disabled' do
before do
stub_feature_flags(enforce_storage_limit_for_paid: false)
end
it { is_expected.to eq(false) }
end
context 'when subscription start date is on or after effective date' do
it { is_expected.to eq(true) }
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment