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