diff --git a/ee/app/models/gitlab_subscriptions/add_on_purchase.rb b/ee/app/models/gitlab_subscriptions/add_on_purchase.rb index d231e8d3f44979c140b050f34369b1cbfdae73d9..a2a20d709f8a750fd32b2ec0402fcbb429bfcad8 100644 --- a/ee/app/models/gitlab_subscriptions/add_on_purchase.rb +++ b/ee/app/models/gitlab_subscriptions/add_on_purchase.rb @@ -107,19 +107,7 @@ class AddOnPurchase < ApplicationRecord .limit(limit) end - # TODO: Consolidate this with for_self_hosted_dap scope below - scope :for_duo_self_hosted, -> { where(subscription_add_on_id: AddOn.self_hosted_dap.pick(:id)) } - # Placeholder scope for Self-hosted DAP SKU - # Returns all active self-managed add-ons when feature flag is enabled - # TODO: Filter by actual Self-hosted DAP add-on when provisioned by Fulfillment - # Tracked in: https://gitlab.com/gitlab-org/gitlab/-/issues/582054 - scope :for_self_hosted_dap, -> { - if Feature.enabled?(:self_hosted_dap_sku, :instance) - for_self_managed.active - else - none - end - } + scope :for_self_hosted_dap, -> { where(subscription_add_on_id: AddOn.self_hosted_dap.pick(:id)) } delegate :name, :seat_assignable?, to: :add_on, prefix: true diff --git a/ee/app/services/gitlab_subscriptions/add_on_purchases/self_managed/provision_services/self_hosted_dap.rb b/ee/app/services/gitlab_subscriptions/add_on_purchases/self_managed/provision_services/self_hosted_dap.rb index 4bd7e6c5cffe3f79b900d62982114be58ce99a2e..f9a39c4652e15bc9b2cdefd62658b3a3bc5a5263 100644 --- a/ee/app/services/gitlab_subscriptions/add_on_purchases/self_managed/provision_services/self_hosted_dap.rb +++ b/ee/app/services/gitlab_subscriptions/add_on_purchases/self_managed/provision_services/self_hosted_dap.rb @@ -8,7 +8,7 @@ class SelfHostedDap < Base private def add_on_purchase - GitlabSubscriptions::AddOnPurchase.for_self_managed.for_duo_self_hosted.first + GitlabSubscriptions::AddOnPurchase.for_self_managed.for_self_hosted_dap.first end strong_memoize_attr :add_on_purchase diff --git a/ee/config/feature_flags/development/self_hosted_dap_sku.yml b/ee/config/feature_flags/development/self_hosted_dap_sku.yml deleted file mode 100644 index 62d8e818d1a1b83cd9a2726190ad24e84f2e3d87..0000000000000000000000000000000000000000 --- a/ee/config/feature_flags/development/self_hosted_dap_sku.yml +++ /dev/null @@ -1,9 +0,0 @@ ---- -name: self_hosted_dap_sku -feature_issue_url: https://gitlab.com/groups/gitlab-org/-/epics/20079 -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/214790 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/work_items/582204 -milestone: '18.7' -group: group::custom models -type: development -default_enabled: false diff --git a/ee/spec/models/gitlab_subscriptions/add_on_purchase_spec.rb b/ee/spec/models/gitlab_subscriptions/add_on_purchase_spec.rb index 7549598829dd5c7128ae243f37e9bdbbb7480dd0..4b6b7cdd5d8a63ffbf54a616559edeff573188ad 100644 --- a/ee/spec/models/gitlab_subscriptions/add_on_purchase_spec.rb +++ b/ee/spec/models/gitlab_subscriptions/add_on_purchase_spec.rb @@ -406,8 +406,8 @@ end end - describe '.for_duo_self_hosted' do - subject(:self_hosted_dap_add_on_purchases) { described_class.for_duo_self_hosted } + describe '.for_self_hosted_dap' do + subject(:self_hosted_dap_add_on_purchases) { described_class.for_self_hosted_dap } it { expect(self_hosted_dap_add_on_purchases).to be_empty } @@ -782,34 +782,6 @@ expect(described_class.find_by_namespace_and_add_on(namespace, add_on_1)).to eq add_on_purchase_2 end end - - describe '.for_self_hosted_dap' do - subject(:scope) { described_class.for_self_hosted_dap } - - context 'when self_hosted_dap_sku feature flag is disabled' do - before do - stub_feature_flags(self_hosted_dap_sku: false) - end - - it 'returns none' do - expect(scope).to be_empty - end - end - - context 'when self_hosted_dap_sku feature flag is enabled' do - before do - stub_feature_flags(self_hosted_dap_sku: true) - end - - it 'returns active self-managed add-ons' do - active_sm_addon = create(:gitlab_subscription_add_on_purchase, :duo_enterprise, :active, :self_managed) - create(:gitlab_subscription_add_on_purchase, :duo_pro, :expired, :self_managed) - create(:gitlab_subscription_add_on_purchase, :duo_core, :active) # SaaS - - expect(scope).to contain_exactly(active_sm_addon) - end - end - end end describe 'delegations' do