Commit 8cbe5da3 authored by Jan Provaznik's avatar Jan Provaznik

Merge branch 'ff-for-requiring-cc-to-old-users' into 'master'

Add feature flag to extend credit card requirement [RUN ALL RSPEC] [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!61565
parents cd8e1c40 2e9dd569
...@@ -412,8 +412,9 @@ module EE ...@@ -412,8 +412,9 @@ module EE
private private
def created_after_credit_card_release_day? def created_after_credit_card_release_day?(project)
created_at >= ::Users::CreditCardValidation::RELEASE_DAY created_at >= ::Users::CreditCardValidation::RELEASE_DAY ||
::Feature.enabled?(:ci_require_credit_card_for_old_users, project, default_enabled: :yaml)
end end
def has_valid_credit_card? def has_valid_credit_card?
...@@ -422,7 +423,7 @@ module EE ...@@ -422,7 +423,7 @@ module EE
def requires_credit_card_to_run_pipelines?(project) def requires_credit_card_to_run_pipelines?(project)
return false unless ::Gitlab.com? return false unless ::Gitlab.com?
return false unless created_after_credit_card_release_day? return false unless created_after_credit_card_release_day?(project)
root_namespace = project.root_namespace root_namespace = project.root_namespace
if root_namespace.free_plan? if root_namespace.free_plan?
......
---
name: ci_require_credit_card_for_old_users
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/61565
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/330706
milestone: '13.12'
type: development
group: group::continuous integration
default_enabled: false
...@@ -1683,21 +1683,23 @@ RSpec.describe User do ...@@ -1683,21 +1683,23 @@ RSpec.describe User do
using RSpec::Parameterized::TableSyntax using RSpec::Parameterized::TableSyntax
where(:is_saas, :cc_present, :is_free, :is_trial, :free_ff_enabled, :trial_ff_enabled, :days_from_release, :result) do where(:is_saas, :cc_present, :is_free, :is_trial, :free_ff_enabled, :trial_ff_enabled, :old_users_ff_enabled, :days_from_release, :result, :description) do
# self-hosted # self-hosted
false | false | false | false | true | true | 0 | true # paid plan false | false | false | false | true | true | false | 0 | true | 'self-hosted paid plan'
false | false | false | true | true | true | 0 | true # missing CC on trial plan false | false | false | true | true | true | false | 0 | true | 'self-hosted missing CC on trial plan'
# saas # saas
true | false | false | false | true | true | 0 | true # missing CC on paid plan true | false | false | false | true | true | false | 0 | true | 'missing CC on paid plan'
true | false | true | false | true | true | 0 | false # missing CC on free plan true | false | true | false | true | true | false | 0 | false | 'missing CC on free plan'
true | false | true | false | true | true | -1 | true # missing CC on free plan but old user true | false | true | false | true | true | false | -1 | true | 'missing CC on free plan but old user'
true | false | true | false | false | true | 0 | true # missing CC on free plan - FF off true | false | true | false | true | true | true | -1 | false | 'missing CC on free plan but old user and FF enabled'
true | false | false | true | true | true | 0 | false # missing CC on trial plan true | false | true | false | false | true | false | 0 | true | 'missing CC on free plan - FF off'
true | false | false | true | true | true | -1 | true # missing CC on trial plan but old user true | false | false | true | true | true | false | 0 | false | 'missing CC on trial plan'
true | false | false | true | true | false | 0 | true # missing CC on trial plan - FF off true | false | false | true | true | true | false | -1 | true | 'missing CC on trial plan but old user'
true | true | true | false | true | true | 0 | true # present CC on free plan true | false | false | true | true | true | true | -1 | false | 'missing CC on trial plan but old user and FF enabled'
true | true | false | true | true | true | 0 | true # present CC on trial plan true | false | false | true | true | false | false | 0 | true | 'missing CC on trial plan - FF off'
true | true | true | false | true | true | false | 0 | true | 'present CC on free plan'
true | true | false | true | true | true | false | 0 | true | 'present CC on trial plan'
end end
with_them do with_them do
...@@ -1709,10 +1711,13 @@ RSpec.describe User do ...@@ -1709,10 +1711,13 @@ RSpec.describe User do
allow(project.namespace).to receive(:trial?).and_return(is_trial) allow(project.namespace).to receive(:trial?).and_return(is_trial)
stub_feature_flags( stub_feature_flags(
ci_require_credit_card_on_free_plan: free_ff_enabled, ci_require_credit_card_on_free_plan: free_ff_enabled,
ci_require_credit_card_on_trial_plan: trial_ff_enabled) ci_require_credit_card_on_trial_plan: trial_ff_enabled,
ci_require_credit_card_for_old_users: old_users_ff_enabled)
end end
it { is_expected.to eq(result) } it description do
expect(subject).to eq(result)
end
end end
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