From c212f2af8d16c2f0628549049853825692d50fa3 Mon Sep 17 00:00:00 2001 From: Angelo Gulina Date: Fri, 13 Jun 2025 14:48:48 +0200 Subject: [PATCH 1/3] Notify Owner when all seats are used Owners of Namespaces with no Restricted Access activated will be notified when all seats have been used. They will be prompted to take measures. --- app/views/layouts/_alerts.html.haml | 1 - app/views/layouts/group.html.haml | 1 + app/views/layouts/project.html.haml | 1 + .../all_seats_used_alert_component.html.haml | 6 + .../all_seats_used_alert_component.rb | 75 ++++++++++ .../all_seats_used_alert_component.html.haml | 2 +- .../header/_seat_count_alert.html.haml | 11 +- .../wip/notify_all_seats_used.yml | 10 ++ .../all_seats_used_alert_component_spec.rb | 139 ++++++++++++++++++ .../features/groups/group_overview_spec.rb | 33 +++-- .../namespace_user_cap_reached_alert_spec.rb | 2 +- .../features/projects/show_project_spec.rb | 10 +- .../configuration_controller_spec.rb | 2 +- .../settings/gitlab_duo_controller_spec.rb | 4 +- locale/gitlab.pot | 3 + 15 files changed, 272 insertions(+), 28 deletions(-) create mode 100644 ee/app/components/namespaces/all_seats_used_alert_component.html.haml create mode 100644 ee/app/components/namespaces/all_seats_used_alert_component.rb create mode 100644 ee/config/feature_flags/wip/notify_all_seats_used.yml create mode 100644 ee/spec/components/namespaces/all_seats_used_alert_component_spec.rb diff --git a/app/views/layouts/_alerts.html.haml b/app/views/layouts/_alerts.html.haml index e79596c1f73bb0..aface85e7e2cf4 100644 --- a/app/views/layouts/_alerts.html.haml +++ b/app/views/layouts/_alerts.html.haml @@ -16,7 +16,6 @@ = dispensable_render "shared/service_ping_consent" = yield :group_invite_members_banner = dispensable_render_if_exists "layouts/header/ee_subscribable_banner" - = dispensable_render_if_exists "layouts/header/seat_count_alert", context: context = dispensable_render_if_exists "shared/namespace_user_cap_reached_alert" = dispensable_render_if_exists "shared/new_user_signups_cap_reached_alert" = dispensable_render_if_exists "shared/silent_mode_banner" diff --git a/app/views/layouts/group.html.haml b/app/views/layouts/group.html.haml index 88fe27d84eef67..077df2c21d3e12 100644 --- a/app/views/layouts/group.html.haml +++ b/app/views/layouts/group.html.haml @@ -9,6 +9,7 @@ = dispensable_render_if_exists "groups/storage_enforcement_alert", context: @group = dispensable_render_if_exists "shared/namespace_storage_limit_alert", context: @group = dispensable_render_if_exists "shared/namespace_combined_storage_users_alert", context: @group + = dispensable_render_if_exists "layouts/header/seat_count_alert", context: @group - content_for :page_specific_javascripts do - if current_user diff --git a/app/views/layouts/project.html.haml b/app/views/layouts/project.html.haml index ff818aea5b9106..7441e4cd7845c4 100644 --- a/app/views/layouts/project.html.haml +++ b/app/views/layouts/project.html.haml @@ -10,6 +10,7 @@ = dispensable_render_if_exists "projects/storage_enforcement_alert", context: @project = dispensable_render_if_exists "shared/namespace_storage_limit_alert", context: @project = dispensable_render_if_exists "shared/namespace_combined_storage_users_alert", context: @project + = dispensable_render_if_exists "layouts/header/seat_count_alert", context: @project - content_for :project_javascripts do - project = @target_project || @project diff --git a/ee/app/components/namespaces/all_seats_used_alert_component.html.haml b/ee/app/components/namespaces/all_seats_used_alert_component.html.haml new file mode 100644 index 00000000000000..ca8185193d36ed --- /dev/null +++ b/ee/app/components/namespaces/all_seats_used_alert_component.html.haml @@ -0,0 +1,6 @@ += render Pajamas::AlertComponent.new(variant: :warning, + dismissible: false, + alert_options: { class: [content_class], data: { testid: 'all-seats-used-alert' }}, + title: _('No more seats in subscription')) do |c| + - c.with_body do + = alert_body diff --git a/ee/app/components/namespaces/all_seats_used_alert_component.rb b/ee/app/components/namespaces/all_seats_used_alert_component.rb new file mode 100644 index 00000000000000..5ff6c097ff6080 --- /dev/null +++ b/ee/app/components/namespaces/all_seats_used_alert_component.rb @@ -0,0 +1,75 @@ +# frozen_string_literal: true + +module Namespaces + class AllSeatsUsedAlertComponent < ViewComponent::Base + include SafeFormatHelper + + def initialize(context:, content_class:, current_user:) + @root_namespace = context.root_ancestor + @content_class = content_class + @current_user = current_user + end + + def render? + return false unless feature_available? + return false if root_namespace.free_plan? || block_seat_overages? + return false unless owner? && group_namespace? + + all_seats_used? + end + + private + + attr_reader :root_namespace, :content_class, :current_user + + def feature_available? + Feature.enabled?(:notify_all_seats_used, root_namespace, type: :wip) && + ::Gitlab::Saas.feature_available?(:gitlab_com_subscriptions) + end + + def alert_body + safe_format(s_("SeatsManagement|Your namespace has used all the seats in your subscription. To avoid overages " \ + "from adding new users, consider %{settings_link_start}turning on restricted " \ + "access%{settings_link_end}, or %{more_seats_link_start}purchase more seats%{more_seats_link_end}."), + settings_link, + more_seats_link + ) + end + + def all_seats_used? + billable_members_count = root_namespace.billable_members_count_with_reactive_cache + + return false if billable_members_count.blank? + + subscription.seats <= billable_members_count + end + + def block_seat_overages? + subscription.has_a_paid_hosted_plan? && root_namespace.block_seat_overages? + end + + def group_namespace? + root_namespace.group_namespace? + end + + def subscription + root_namespace.gitlab_subscription + end + + def owner? + Ability.allowed?(current_user, :owner_access, root_namespace) + end + + def more_seats_link + link = link_to('', help_page_path('subscriptions/manage_users_and_seats.md', anchor: 'buy-more-seats')) + + tag_pair(link, :more_seats_link_start, :more_seats_link_end) + end + + def settings_link + link = link_to('', help_page_path('user/group/manage.md', anchor: "turn-on-restricted-access")) + + tag_pair(link, :settings_link_start, :settings_link_end) + end + end +end diff --git a/ee/app/components/namespaces/block_seat_overages/all_seats_used_alert_component.html.haml b/ee/app/components/namespaces/block_seat_overages/all_seats_used_alert_component.html.haml index 551a315a6a68bd..77b2bcc0b5c582 100644 --- a/ee/app/components/namespaces/block_seat_overages/all_seats_used_alert_component.html.haml +++ b/ee/app/components/namespaces/block_seat_overages/all_seats_used_alert_component.html.haml @@ -3,7 +3,7 @@ data: { dismiss_endpoint: group_callouts_path, feature_id: EE::Users::GroupCalloutsHelper::ALL_SEATS_USED_ALERT, group_id: root_namespace.id, - testid: 'all-seats-used-alert' }}, + testid: 'bso-all-seats-used-alert' }}, title: _('No more seats in subscription'), variant: :warning) do |c| - c.with_body do diff --git a/ee/app/views/layouts/header/_seat_count_alert.html.haml b/ee/app/views/layouts/header/_seat_count_alert.html.haml index db40a8099aeeaf..dc42ad781c5b0d 100644 --- a/ee/app/views/layouts/header/_seat_count_alert.html.haml +++ b/ee/app/views/layouts/header/_seat_count_alert.html.haml @@ -1,4 +1,11 @@ -- if show_seat_count_alert? +- all_seats_used_component = Namespaces::AllSeatsUsedAlertComponent.new(context: context, content_class: '', current_user: current_user) +- bso_all_seats_used_component = Namespaces::BlockSeatOverages::AllSeatsUsedAlertComponent.new(context: context, content_class: full_content_class, current_user: current_user) + +- if all_seats_used_component.render? + = render all_seats_used_component +- elsif bso_all_seats_used_component.render? + = render bso_all_seats_used_component +- elsif show_seat_count_alert? = render Pajamas::AlertComponent.new(alert_options: { class: 'js-approaching-seat-count-threshold', data: { dismiss_endpoint: group_callouts_path, feature_id: Users::GroupCalloutsHelper::APPROACHING_SEAT_COUNT_THRESHOLD, @@ -11,5 +18,3 @@ = link_to _('Learn more.'), seat_count_help_page_link, target: '_blank', rel: 'noopener noreferrer' - c.with_actions do = link_button_to _('View seat usage'), usage_quotas_path(namespace, anchor: 'seats-quota-tab'), class: 'gl-alert-action', variant: :confirm -- else - = render Namespaces::BlockSeatOverages::AllSeatsUsedAlertComponent.new(context: context, content_class: full_content_class, current_user: current_user) diff --git a/ee/config/feature_flags/wip/notify_all_seats_used.yml b/ee/config/feature_flags/wip/notify_all_seats_used.yml new file mode 100644 index 00000000000000..158831823515ac --- /dev/null +++ b/ee/config/feature_flags/wip/notify_all_seats_used.yml @@ -0,0 +1,10 @@ +--- +name: notify_all_seats_used +description: +feature_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/523557 +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/193889 +rollout_issue_url: +milestone: '18.2' +group: group::seat management +type: wip +default_enabled: false diff --git a/ee/spec/components/namespaces/all_seats_used_alert_component_spec.rb b/ee/spec/components/namespaces/all_seats_used_alert_component_spec.rb new file mode 100644 index 00000000000000..de167060aed600 --- /dev/null +++ b/ee/spec/components/namespaces/all_seats_used_alert_component_spec.rb @@ -0,0 +1,139 @@ +# frozen_string_literal: true + +require "spec_helper" + +RSpec.describe Namespaces::AllSeatsUsedAlertComponent, :saas, feature_category: :seat_cost_management do + include ReactiveCachingHelpers + + let(:user) { build_stubbed(:user, :with_namespace) } + let(:namespace) { build(:group, namespace_settings: build(:namespace_settings, seat_control: :off)) } + + let(:classes) { nil } + let(:billable_members_count) { 2 } + let(:permission_owner) { true } + + let(:element) { find_by_testid('all-seats-used-alert') } + + subject(:component) do + described_class.new( + context: namespace, + content_class: classes, + current_user: user + ) + end + + before do + allow(namespace).to receive(:billable_members_count).and_return(billable_members_count) + allow(Ability).to receive(:allowed?).with(user, :owner_access, namespace).and_return(permission_owner) + + build(:gitlab_subscription, namespace: namespace, plan_code: Plan::ULTIMATE, seats: 2) + end + + shared_examples_for 'not rendering the alert' do + it 'does not render the alert' do + render_inline(component) + + expect(page).not_to have_content('Your namespace has used all the seats') + end + end + + shared_examples_for 'rendering the alert' do + before do + render_inline(component) + end + + it 'renders a warning alert' do + expect(element).to match_css('.gl-alert.gl-alert-warning') + end + + it 'shows a title' do + expect(element).to have_text "No more seats in subscription" + end + + it 'shows an info text' do + expect(element).to have_text "Your namespace has used all the seats in your subscription. " \ + "To avoid overages from adding new users, consider turning on restricted access, or purchase more seats." + end + + it 'contains the correct links' do + expect(element).to have_link 'turning on restricted access', href: + help_page_path('user/group/manage.md', anchor: 'turn-on-restricted-access') + expect(element).to have_link 'purchase more seats', href: + help_page_path('subscriptions/manage_users_and_seats.md', anchor: 'buy-more-seats') + end + end + + context 'with a reactive cache hit' do + before do + synchronous_reactive_cache(namespace) + end + + describe 'with custom classes' do + let(:classes) { 'test-class' } + + it 'adds custom class to the alert' do + render_inline(component) + + expect(element).to match_css('.test-class') + end + end + + describe 'when namespace has no paid plan' do + before do + build(:gitlab_subscription, namespace: namespace, plan_code: Plan::FREE) + end + + it_behaves_like 'not rendering the alert' + end + + describe 'when user is not a owner' do + let(:permission_owner) { false } + + it_behaves_like 'not rendering the alert' + end + + describe 'when block seats overages is enabled' do + let(:namespace) do + build(:group, namespace_settings: build(:namespace_settings, seat_control: :block_overages)) + end + + it_behaves_like 'not rendering the alert' + end + + describe 'with no billable members' do + let(:billable_members_count) { 0 } + + it_behaves_like 'not rendering the alert' + end + + describe 'when namespace is personal' do + let(:namespace) { build(:user, :with_namespace).namespace } + + it_behaves_like 'not rendering the alert' + end + + context 'with notify_all_seats_used disabled' do + before do + stub_feature_flags(notify_all_seats_used: false) + end + + it_behaves_like 'not rendering the alert' + end + + describe 'with more billable members than seats' do + let(:billable_members_count) { 3 } + + it_behaves_like 'rendering the alert' + end + + it_behaves_like 'rendering the alert' + end + + context 'with a reactive cache miss' do + before do + stub_reactive_cache(namespace, nil) + end + + it_behaves_like 'not rendering the alert' + end +end diff --git a/ee/spec/features/groups/group_overview_spec.rb b/ee/spec/features/groups/group_overview_spec.rb index efdf420f52042c..9469106d2386bc 100644 --- a/ee/spec/features/groups/group_overview_spec.rb +++ b/ee/spec/features/groups/group_overview_spec.rb @@ -104,17 +104,20 @@ let_it_be(:subscription) { create(:gitlab_subscription, :premium, namespace: group, seats: 1) } before do - group.namespace_settings.update!(seat_control: :block_overages) stub_billable_members_reactive_cache(group) end - context 'when the user is an owner' do + context 'with seat block overages enabled' do + before do + group.namespace_settings.update!(seat_control: :block_overages) + end + it 'displays the all seats used alert' do visit_page - expect(page).to have_css '[data-testid="all-seats-used-alert"].gl-alert-warning' + expect(page).to have_css '[data-testid="bso-all-seats-used-alert"].gl-alert-warning' - within_testid('all-seats-used-alert') do + within_testid('bso-all-seats-used-alert') do expect(page).to have_css('[data-testid="close-icon"]') expect(page).to have_text "No more seats in subscription" expect(page).to have_text "Your namespace has used all the seats in your subscription and users can " \ @@ -123,18 +126,18 @@ help_page_path('subscriptions/manage_users_and_seats.md', anchor: 'buy-more-seats') end end + end - context 'when the user is not an owner' do - where(:role) do - ::Gitlab::Access.sym_options.keys.map(&:to_sym) - end + context 'when the user is not an owner' do + where(:role) do + ::Gitlab::Access.sym_options.keys.map(&:to_sym) + end - with_them do - it 'does not display the all seats used alert' do - visit_page + with_them do + it 'does not display the all seats used alert' do + visit_page - expect(page).not_to have_css '[data-testid="all-seats-used-alert"].gl-alert-warning' - end + expect(page).not_to have_css '[data-testid="bso-all-seats-used-alert"].gl-alert-warning' end end end @@ -150,7 +153,7 @@ it 'does not display the all seats used alert' do visit_page - expect(page).not_to have_css '[data-testid="all-seats-used-alert"].gl-alert-warning' + expect(page).not_to have_css '[data-testid="bso-all-seats-used-alert"].gl-alert-warning' end end @@ -164,7 +167,7 @@ it 'does not display the all seats used alert' do visit_page - expect(page).not_to have_css '[data-testid="all-seats-used-alert"].gl-alert-warning' + expect(page).not_to have_css '[data-testid="bso-all-seats-used-alert"].gl-alert-warning' end end end diff --git a/ee/spec/features/namespace_user_cap_reached_alert_spec.rb b/ee/spec/features/namespace_user_cap_reached_alert_spec.rb index 48323b0c8f030b..df71ece2967ebd 100644 --- a/ee/spec/features/namespace_user_cap_reached_alert_spec.rb +++ b/ee/spec/features/namespace_user_cap_reached_alert_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Namespace user cap reached alert', :feature, :js, :use_clean_rails_memory_store_caching, +RSpec.describe 'Namespace user cap reached alert', :feature, :js, :saas, :use_clean_rails_memory_store_caching, feature_category: :seat_cost_management do include BillableMembersHelpers diff --git a/ee/spec/features/projects/show_project_spec.rb b/ee/spec/features/projects/show_project_spec.rb index 50da0d1a8504ad..e74de2d4a5e003 100644 --- a/ee/spec/features/projects/show_project_spec.rb +++ b/ee/spec/features/projects/show_project_spec.rb @@ -142,9 +142,9 @@ it 'displays the all seats used alert' do visit project_path(project) - expect(page).to have_css '[data-testid="all-seats-used-alert"].gl-alert-warning' + expect(page).to have_css '[data-testid="bso-all-seats-used-alert"].gl-alert-warning' - within_testid('all-seats-used-alert') do + within_testid('bso-all-seats-used-alert') do expect(page).to have_css('[data-testid="close-icon"]') expect(page).to have_text "No more seats in subscription" expect(page).to have_text "Your namespace has used all the seats in your subscription and users can " \ @@ -161,7 +161,7 @@ it 'does not display the all seats used alert' do visit project_path(project) - expect(page).not_to have_css '[data-testid="all-seats-used-alert"].gl-alert-warning' + expect(page).not_to have_css '[data-testid="bso-all-seats-used-alert"].gl-alert-warning' end end end @@ -176,7 +176,7 @@ it 'does not display the all seats used alert' do visit project_path(project) - expect(page).not_to have_css '[data-testid="all-seats-used-alert"].gl-alert-warning' + expect(page).not_to have_css '[data-testid="bso-all-seats-used-alert"].gl-alert-warning' end end @@ -190,7 +190,7 @@ it 'does not display the all seats used alert' do visit project_path(project) - expect(page).not_to have_css '[data-testid="all-seats-used-alert"].gl-alert-warning' + expect(page).not_to have_css '[data-testid="bso-all-seats-used-alert"].gl-alert-warning' end end end diff --git a/ee/spec/requests/groups/settings/gitlab_duo/configuration_controller_spec.rb b/ee/spec/requests/groups/settings/gitlab_duo/configuration_controller_spec.rb index 23fa1f01dfd91b..91e960cb613e51 100644 --- a/ee/spec/requests/groups/settings/gitlab_duo/configuration_controller_spec.rb +++ b/ee/spec/requests/groups/settings/gitlab_duo/configuration_controller_spec.rb @@ -20,7 +20,7 @@ group.add_owner(user) end - context 'when show_gitlab_duo_settings_menu_item? returns true' do + context 'when show_gitlab_duo_settings_menu_item? returns true', :saas do before do stub_saas_features(gitlab_com_subscriptions: true) allow(controller).to receive(:show_gitlab_duo_settings_menu_item?).and_return(true) diff --git a/ee/spec/requests/groups/settings/gitlab_duo_controller_spec.rb b/ee/spec/requests/groups/settings/gitlab_duo_controller_spec.rb index 1899232245a4d1..7058c37dddb82e 100644 --- a/ee/spec/requests/groups/settings/gitlab_duo_controller_spec.rb +++ b/ee/spec/requests/groups/settings/gitlab_duo_controller_spec.rb @@ -31,7 +31,9 @@ end end - context "when show_gitlab_duo_settings_app? returns true" do + context "when show_gitlab_duo_settings_app? returns true", :saas do + let_it_be(:group) { create(:group_with_plan, owners: owner) } + before do stub_saas_features(gitlab_com_subscriptions: true) end diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 6d150ace072065..7233c548390302 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -57184,6 +57184,9 @@ msgstr "" msgid "Seats owed" msgstr "" +msgid "SeatsManagement|Your namespace has used all the seats in your subscription. To avoid overages from adding new users, consider %{settings_link_start}turning on restricted access%{settings_link_end}, or %{more_seats_link_start}purchase more seats%{more_seats_link_end}." +msgstr "" + msgid "Secondary email:" msgstr "" -- GitLab From de55da53ad25e4a34771e8ae7f07801f4b56089c Mon Sep 17 00:00:00 2001 From: Angelo Gulina Date: Mon, 8 Sep 2025 14:13:26 +0200 Subject: [PATCH 2/3] Update milestone for feature flag --- ee/config/feature_flags/wip/notify_all_seats_used.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ee/config/feature_flags/wip/notify_all_seats_used.yml b/ee/config/feature_flags/wip/notify_all_seats_used.yml index 158831823515ac..a44a035589892d 100644 --- a/ee/config/feature_flags/wip/notify_all_seats_used.yml +++ b/ee/config/feature_flags/wip/notify_all_seats_used.yml @@ -4,7 +4,7 @@ description: feature_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/523557 introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/193889 rollout_issue_url: -milestone: '18.2' +milestone: '18.4' group: group::seat management type: wip default_enabled: false -- GitLab From 8c27af8d3c6d0e084770380977eeb99917c6bbc8 Mon Sep 17 00:00:00 2001 From: Angelo Gulina Date: Tue, 9 Sep 2025 08:21:31 +0200 Subject: [PATCH 3/3] Update specs setup --- .../controllers/ee/groups_controller_spec.rb | 6 ++++-- .../controllers/projects_controller_spec.rb | 18 +++++++++--------- .../features/groups/saml_group_links_spec.rb | 2 +- .../seat_utilization_controller_spec.rb | 8 ++++---- .../service_accounts_controller_spec.rb | 2 +- ee/spec/requests/groups/usage_quotas_spec.rb | 2 +- .../projects/merge_requests_controller_spec.rb | 2 +- 7 files changed, 21 insertions(+), 19 deletions(-) diff --git a/ee/spec/controllers/ee/groups_controller_spec.rb b/ee/spec/controllers/ee/groups_controller_spec.rb index ffd7b7f24da5ba..c9c723cde60bc8 100644 --- a/ee/spec/controllers/ee/groups_controller_spec.rb +++ b/ee/spec/controllers/ee/groups_controller_spec.rb @@ -24,7 +24,9 @@ sign_in(user) end - it_behaves_like 'namespace storage limit alert' + describe 'with storage limit', :saas do + it_behaves_like 'namespace storage limit alert' + end it_behaves_like 'seat count alert' @@ -596,7 +598,7 @@ def request(visibility_level) end end - context 'when ai settings are specified' do + context 'when ai settings are specified', :saas do let(:group) { create(:group_with_plan, plan: :ultimate_plan, trial_ends_on: Date.tomorrow) } before do diff --git a/ee/spec/controllers/projects_controller_spec.rb b/ee/spec/controllers/projects_controller_spec.rb index b7b3d9079eabdc..4aa72f54a95f2d 100644 --- a/ee/spec/controllers/projects_controller_spec.rb +++ b/ee/spec/controllers/projects_controller_spec.rb @@ -76,7 +76,7 @@ subject { get :show, params: { namespace_id: public_project.namespace.path, id: public_project.path } } - context 'additional repo storage by namespace', feature_category: :consumables_cost_management do + context 'additional repo storage by namespace', :saas, feature_category: :consumables_cost_management do before do stub_saas_features(namespaces_storage_limit: true) stub_feature_flags(namespace_storage_limit: false) @@ -135,6 +135,14 @@ expect(response.body).not_to match(/purchase more storage/) end + + context 'namespace storage limit' do + let(:namespace) { public_project.namespace } + + it_behaves_like 'namespace storage limit alert' + + it_behaves_like 'seat count alert' + end end end @@ -175,14 +183,6 @@ expect(response.body).not_to match(/The size of this repository.+exceeds the limit/) end end - - context 'namespace storage limit', feature_category: :consumables_cost_management do - let(:namespace) { public_project.namespace } - - it_behaves_like 'namespace storage limit alert' - - it_behaves_like 'seat count alert' - end end describe 'POST create', feature_category: :groups_and_projects do diff --git a/ee/spec/features/groups/saml_group_links_spec.rb b/ee/spec/features/groups/saml_group_links_spec.rb index 386b26fb62eba1..9d81e9d7e79e72 100644 --- a/ee/spec/features/groups/saml_group_links_spec.rb +++ b/ee/spec/features/groups/saml_group_links_spec.rb @@ -83,7 +83,7 @@ end end - context 'when custom roles are enabled' do + context 'when custom roles are enabled', :saas do before do stub_licensed_features(group_saml: true, saml_group_sync: true, custom_roles: true) stub_saas_features(gitlab_com_subscriptions: true) diff --git a/ee/spec/requests/groups/settings/gitlab_duo/seat_utilization_controller_spec.rb b/ee/spec/requests/groups/settings/gitlab_duo/seat_utilization_controller_spec.rb index acf1566ee7c0fb..b8ea10f0a8b6e3 100644 --- a/ee/spec/requests/groups/settings/gitlab_duo/seat_utilization_controller_spec.rb +++ b/ee/spec/requests/groups/settings/gitlab_duo/seat_utilization_controller_spec.rb @@ -56,7 +56,7 @@ it_behaves_like 'renders not found error' end - context "when show_gitlab_duo_settings_app? returns true" do + context "when show_gitlab_duo_settings_app? returns true", :saas do before do stub_saas_features(gitlab_com_subscriptions: true) end @@ -64,7 +64,7 @@ it_behaves_like 'renders seat management index page for group' end - context 'with a non seat assignable duo add on' do + context 'with a non seat assignable duo add on', :saas do before do stub_saas_features(gitlab_com_subscriptions: true) end @@ -82,7 +82,7 @@ end end - context 'when in a subgroup' do + context 'when in a subgroup', :saas do let(:subgroup) { create(:group, :private, parent: group) } before do @@ -98,7 +98,7 @@ end end - context 'when user does not have read_usage_quotas permission' do + context 'when user does not have read_usage_quotas permission', :saas do before do group.add_maintainer(user) # rubocop:disable RSpec/BeforeAllRoleAssignment -- cannot use stub_saas_features in before_all stub_saas_features(gitlab_com_subscriptions: true) diff --git a/ee/spec/requests/groups/settings/service_accounts_controller_spec.rb b/ee/spec/requests/groups/settings/service_accounts_controller_spec.rb index 32de33b5be26ab..bec532620e922e 100644 --- a/ee/spec/requests/groups/settings/service_accounts_controller_spec.rb +++ b/ee/spec/requests/groups/settings/service_accounts_controller_spec.rb @@ -39,7 +39,7 @@ it_behaves_like 'page is found' end - context 'when in SaaS mode' do + context 'when in SaaS mode', :saas do before do stub_saas_features(gitlab_com_subscriptions: true) end diff --git a/ee/spec/requests/groups/usage_quotas_spec.rb b/ee/spec/requests/groups/usage_quotas_spec.rb index 910e937a190c5e..60ef223cbb4b50 100644 --- a/ee/spec/requests/groups/usage_quotas_spec.rb +++ b/ee/spec/requests/groups/usage_quotas_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'view usage quotas', feature_category: :consumables_cost_management do +RSpec.describe 'view usage quotas', :saas, feature_category: :consumables_cost_management do let_it_be(:namespace) { create(:group) } let_it_be(:user) { create(:user) } let_it_be(:subscription_history) do diff --git a/ee/spec/requests/projects/merge_requests_controller_spec.rb b/ee/spec/requests/projects/merge_requests_controller_spec.rb index ddd7540ace7e72..41c6b4966beddc 100644 --- a/ee/spec/requests/projects/merge_requests_controller_spec.rb +++ b/ee/spec/requests/projects/merge_requests_controller_spec.rb @@ -52,7 +52,7 @@ def get_public_show get project_merge_request_path(public_project, public_merge_request) end - context "with AI features available" do + context "with AI features available", :saas do before do authorizer = instance_double(::Gitlab::Llm::FeatureAuthorizer) allow(::Gitlab::Llm::FeatureAuthorizer).to receive(:new).and_return(authorizer) -- GitLab