Commit 5578410d authored by Dan Jensen's avatar Dan Jensen Committed by Pavel Shutsin

Fix tier for instance and group DevOps Adoption

The DevOps Adoption features, which exist at both the instance and
group levels, are intended to be Ultimate features and were in the
Starter list.

Changelog: changed
parent d1c676e2
......@@ -26,8 +26,6 @@ class License < ApplicationRecord
group_activity_analytics
group_bulk_edit
group_webhooks
instance_level_devops_adoption
group_level_devops_adoption
issuable_default_templates
issue_weights
iterations
......@@ -156,9 +154,11 @@ class License < ApplicationRecord
evaluate_group_level_compliance_pipeline
group_ci_cd_analytics
group_level_compliance_dashboard
group_level_devops_adoption
incident_management
inline_codequality
insights
instance_level_devops_adoption
issuable_health_status
jira_vulnerabilities_integration
jira_issue_association_enforcement
......
---
title: Fix tier for instance and group DevOps Adoption
merge_request: 60032
author:
type: changed
......@@ -21,12 +21,28 @@ RSpec.describe 'Group navbar' do
insert_package_nav(_('Kubernetes'))
end
context 'when devops adoption analytics is available' do
before do
stub_licensed_features(group_level_devops_adoption: true)
insert_after_sub_nav_item(
_('Contribution'),
within: _('Analytics'),
new_sub_nav_item_name: _('DevOps Adoption')
)
visit group_path(group)
end
it_behaves_like 'verified navigation bar'
end
context 'when productivity analytics is available' do
before do
stub_licensed_features(productivity_analytics: true)
insert_after_sub_nav_item(
_('DevOps Adoption'),
_('Contribution'),
within: _('Analytics'),
new_sub_nav_item_name: _('Productivity')
)
......@@ -42,7 +58,7 @@ RSpec.describe 'Group navbar' do
stub_licensed_features(cycle_analytics_for_groups: true)
insert_after_sub_nav_item(
_('DevOps Adoption'),
_('Contribution'),
within: _('Analytics'),
new_sub_nav_item_name: _('Value Stream')
)
......
......@@ -11,6 +11,10 @@ RSpec.describe Resolvers::Admin::Analytics::DevopsAdoption::SegmentsResolver do
resolve(described_class, args: args, ctx: context)
end
before do
stub_licensed_features(instance_level_devops_adoption: true, group_level_devops_adoption: true)
end
describe '#resolve' do
let_it_be(:user) { create(:user) }
let_it_be(:root_group_1) { create(:group, name: 'bbb') }
......@@ -28,11 +32,6 @@ RSpec.describe Resolvers::Admin::Analytics::DevopsAdoption::SegmentsResolver do
create(:devops_adoption_segment, namespace: indirect_subgroup)
end
before do
stub_licensed_features(instance_level_devops_adoption: true)
stub_licensed_features(group_level_devops_adoption: true)
end
subject(:resolved_segments) { resolve_segments(params, { current_user: current_user }) }
let(:params) { {} }
......
......@@ -323,6 +323,10 @@ RSpec.describe GlobalPolicy do
end
context 'when feature is enabled and license include the feature' do
before do
stub_licensed_features(instance_level_devops_adoption: true)
end
it { is_expected.to be_allowed(:view_instance_devops_adoption, :manage_devops_adoption_segments) }
context 'for non-admins' do
......
......@@ -1682,6 +1682,7 @@ RSpec.describe GroupPolicy do
end
before do
stub_licensed_features(group_level_devops_adoption: true)
allow(group).to receive(:feature_available?).with(:group_level_devops_adoption).and_return(false)
enable_admin_mode!(current_user) if current_user.admin?
end
......
......@@ -30,6 +30,8 @@ RSpec.describe 'DevopsAdoptionSegments' do
end
before do
stub_licensed_features(instance_level_devops_adoption: true, group_level_devops_adoption: true)
post_graphql(query, current_user: current_user)
end
......
......@@ -16,6 +16,7 @@ RSpec.describe Analytics::DevopsAdoption::Segments::BulkDeleteService do
before do
enable_admin_mode!(admin)
stub_licensed_features(group_level_devops_adoption: true, instance_level_devops_adoption: true)
end
it 'deletes the segments' do
......
......@@ -19,6 +19,10 @@ RSpec.describe Analytics::DevopsAdoption::Segments::BulkFindOrCreateService do
subject(:response) { described_class.new(params: params, current_user: current_user).execute }
before do
stub_licensed_features(group_level_devops_adoption: true, instance_level_devops_adoption: true)
end
it 'authorizes for manage_devops_adoption' do
expect(::Ability).to receive(:allowed?)
.with(current_user, :manage_devops_adoption_segments, group)
......
......@@ -13,6 +13,10 @@ RSpec.describe Analytics::DevopsAdoption::Segments::CreateService do
subject(:response) { described_class.new(params: params, current_user: current_user).execute }
before do
stub_licensed_features(group_level_devops_adoption: true, instance_level_devops_adoption: true)
end
it 'persists the segment' do
expect(response).to be_success
expect(segment.namespace).to eq(group)
......
......@@ -11,6 +11,10 @@ RSpec.describe Analytics::DevopsAdoption::Segments::DeleteService do
subject(:response) { described_class.new(segment: segment, current_user: current_user).execute }
before do
stub_licensed_features(group_level_devops_adoption: true, instance_level_devops_adoption: true)
end
it 'deletes the segment' do
expect(response).to be_success
expect(segment).not_to be_persisted
......
......@@ -13,7 +13,7 @@ RSpec.describe Analytics::DevopsAdoption::Segments::FindOrCreateService do
subject(:response) { described_class.new(params: params, current_user: current_user).execute }
before do
stub_licensed_features(group_level_devops_adoption: true)
stub_licensed_features(group_level_devops_adoption: true, instance_level_devops_adoption: true)
end
context 'when segment for given namespace already exists' do
......
......@@ -124,8 +124,7 @@ RSpec.shared_context 'group navbar structure' do
{
nav_item: _('Analytics'),
nav_sub_items: [
_('Contribution'),
_('DevOps Adoption')
_('Contribution')
]
}
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