Commit 3cb9a5d9 authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab master

parents c89e99d3 54543d71
---
name: new_route_ci_minutes_purchase
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/54934
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/322582
milestone: '13.10'
type: development
group: group::purchase
default_enabled: true
......@@ -74,9 +74,8 @@ local machine, this is a simple way to get started:
1. On your local machine, run `terraform init`, passing in the following options,
replacing `<YOUR-STATE-NAME>`, `<YOUR-PROJECT-ID>`, `<YOUR-USERNAME>` and
`<YOUR-ACCESS-TOKEN>` with the relevant values. This command initializes your
Terraform state, and stores that state in your GitLab project. The name of
your state can contain only uppercase and lowercase letters, decimal digits,
hyphens, and underscores. This example uses `gitlab.com`:
Terraform state, and stores that state in your GitLab project. This example
uses `gitlab.com`:
```shell
terraform init \
......@@ -90,6 +89,10 @@ local machine, this is a simple way to get started:
-backend-config="retry_wait_min=5"
```
WARNING:
The name of your state can contain only uppercase and lowercase letters, decimal digits,
hyphens, and underscores.
If you already have a GitLab-managed Terraform state, you can use the `terraform init` command
with the pre-populated parameters values:
......
......@@ -11,7 +11,6 @@ class Groups::EpicsController < Groups::ApplicationController
before_action :check_epics_available!
before_action :epic, except: [:index, :create, :new, :bulk_update]
before_action :set_issuables_index, only: :index
before_action :authorize_update_issuable!, only: :update
before_action :authorize_create_epic!, only: [:create, :new]
before_action :verify_group_bulk_edit_enabled!, only: [:bulk_update]
......@@ -33,12 +32,12 @@ class Groups::EpicsController < Groups::ApplicationController
end
def index
@epics = @issuables
respond_to do |format|
format.html
format.json do
render json: serializer.represent(@epics)
set_issuables_index
render json: serializer.represent(@issuables)
end
end
end
......
......@@ -48,8 +48,6 @@ class SubscriptionsController < ApplicationController
@active_subscription = result[:active_subscription]
return render_404 if @group.nil?
render_404 unless Feature.enabled?(:new_route_ci_minutes_purchase, @group, default_enabled: :yaml)
end
def buy_storage
......
......@@ -58,7 +58,7 @@ module EE
private
def use_customers_dot_for_minutes_path?(namespace)
namespace.user_namespace? || ::Feature.disabled?(:new_route_ci_minutes_purchase, namespace, default_enabled: :yaml)
namespace.user_namespace?
end
def use_customers_dot_for_storage_path?(namespace)
......
......@@ -65,94 +65,6 @@ RSpec.describe Groups::EpicsController do
expect(response).to have_gitlab_http_status(:ok)
end
context 'when there is no logged in user' do
it 'stores sorting param in a cookie' do
group.update!(visibility_level: Gitlab::VisibilityLevel::PUBLIC)
sign_out(user)
get :index, params: { group_id: group, sort: 'start_date_asc' }
expect(cookies['epic_sort']).to eq('start_date_asc')
expect(response).to have_gitlab_http_status(:ok)
end
end
context 'when there is a logged in user' do
context 'when epics_sort is nil' do
it 'stores sorting param in user preferences' do
get :index, params: { group_id: group, sort: 'start_date_asc' }
expect(user.user_preference.epics_sort).to eq('start_date_asc')
expect(response).to have_gitlab_http_status(:ok)
end
end
context 'when epics_sort is present' do
it 'update epics_sort with current value' do
user.user_preference.update!(epics_sort: 'created_desc')
get :index, params: { group_id: group, sort: 'start_date_asc' }
expect(user.reload.user_preference.epics_sort).to eq('start_date_asc')
expect(response).to have_gitlab_http_status(:ok)
end
end
it_behaves_like 'issuable list with anonymous search disabled' do
let(:params) { { group_id: group } }
before do
sign_out(user)
group.update!(visibility_level: Gitlab::VisibilityLevel::PUBLIC)
end
end
end
context 'with page param' do
let(:last_page) { group.epics.page.total_pages }
before do
allow(Kaminari.config).to receive(:default_per_page).and_return(1)
end
it 'redirects to last_page if page number is larger than number of pages' do
get :index, params: { group_id: group, page: (last_page + 1).to_param }
expect(response).to redirect_to(group_epics_path(page: last_page, state: controller.params[:state], scope: controller.params[:scope]))
end
it 'renders the specified page' do
get :index, params: { group_id: group, page: last_page.to_param }
expect(assigns(:epics).current_page).to eq(last_page)
expect(response).to have_gitlab_http_status(:ok)
end
it_behaves_like 'disabled when using an external authorization service' do
subject { get :index, params: { group_id: group } }
end
end
context "when epic has multiple labels" do
render_views
let(:label) { create(:label) }
let!(:labeled_epic) { create(:labeled_epic, group: group, labels: [label]) }
it 'does not cause N+1 queries' do
get :index, params: { group_id: group }
control_count = ActiveRecord::QueryRecorder.new do
get :index, params: { group_id: group }
end
label = create(:label)
create(:labeled_epic, group: group, labels: [label])
expect { get :index, params: { group_id: group } }.not_to exceed_query_limit(control_count)
end
end
context 'when format is JSON' do
before do
allow(Kaminari.config).to receive(:default_per_page).and_return(1)
......
......@@ -86,7 +86,6 @@ RSpec.describe SubscriptionsController do
context 'with authenticated user' do
before do
group.add_owner(user)
stub_feature_flags(new_route_ci_minutes_purchase: group)
sign_in(user)
end
......@@ -135,14 +134,6 @@ RSpec.describe SubscriptionsController do
expect(assigns(:group)).to eq group
expect(assigns(:account_id)).to eq nil
end
context 'with :new_route_ci_minutes_purchase disabled' do
before do
stub_feature_flags(new_route_ci_minutes_purchase: false)
end
it { is_expected.to have_gitlab_http_status(:not_found) }
end
end
end
end
......
......@@ -186,27 +186,13 @@ RSpec.describe 'Groups > Usage Quotas' do
end
end
describe 'new_route_ci_minutes_purchase feature flag' do
context 'when is disabled' do
before do
stub_feature_flags(new_route_ci_minutes_purchase: false)
end
it 'points to Customers Portal purchase flow' do
visit_pipeline_quota_page
expect(page).to have_link('Buy additional minutes', href: EE::SUBSCRIPTIONS_MORE_MINUTES_URL)
end
end
context 'when is enabled' do
it 'points to GitLab purchase flow' do
context 'when purchasing CI minutes' do
it 'points to GitLab CI minutes purchase flow' do
visit_pipeline_quota_page
expect(page).to have_link('Buy additional minutes', href: buy_minutes_subscriptions_path(selected_group: group.id))
end
end
end
def visit_pipeline_quota_page
visit group_usage_quotas_path(group)
......
......@@ -179,32 +179,6 @@ RSpec.describe EE::NamespacesHelper do
it { is_expected.to eq buy_minutes_subscriptions_path(selected_group: namespace.id) }
context 'new_route_ci_minutes_purchase' do
context 'when is disabled' do
before do
stub_feature_flags(new_route_ci_minutes_purchase: false)
end
it { is_expected.to eq EE::SUBSCRIPTIONS_MORE_MINUTES_URL }
end
context 'when new_route_ci_minutes_purchase is enabled only for a specific namespace' do
let(:enabled_namespace) { build_stubbed(:group) }
before do
stub_feature_flags(new_route_ci_minutes_purchase: false)
stub_feature_flags(new_route_ci_minutes_purchase: enabled_namespace)
end
it 'returns the default purchase path for the disabled namespace' do
expect(helper.buy_additional_minutes_path(namespace)).to eq EE::SUBSCRIPTIONS_MORE_MINUTES_URL
end
it 'returns GitLab purchase path for the disabled namespace' do
expect(helper.buy_additional_minutes_path(enabled_namespace)).to eq buy_minutes_subscriptions_path(selected_group: enabled_namespace.id)
end
end
context 'when called for a personal namespace' do
let(:user) { create(:user) }
let(:personal_namespace) { build_stubbed(:user_namespace) }
......@@ -214,7 +188,6 @@ RSpec.describe EE::NamespacesHelper do
end
end
end
end
describe '#buy_storage_path' do
subject { helper.buy_storage_path(namespace) }
......@@ -265,35 +238,7 @@ RSpec.describe EE::NamespacesHelper do
let(:namespace) { create(:group) }
context 'new_route_ci_minutes_purchase' do
context 'when is disabled' do
before do
stub_feature_flags(new_route_ci_minutes_purchase: false)
end
it { is_expected.to eq '_blank' }
end
context 'when is enabled' do
it { is_expected.to eq '_self' }
end
context 'when is enabled only for a specific namespace' do
let(:enabled_namespace) { build_stubbed(:group) }
before do
stub_feature_flags(new_route_ci_minutes_purchase: false)
stub_feature_flags(new_route_ci_minutes_purchase: enabled_namespace)
end
it 'returns _blank for the disabled namespace' do
expect(helper.buy_additional_minutes_target(namespace)).to eq '_blank'
end
it 'returns _self for the disabled namespace' do
expect(helper.buy_additional_minutes_target(enabled_namespace)).to eq '_self'
end
end
context 'when called for a personal namespace' do
let(:user) { create(:user) }
......@@ -304,5 +249,4 @@ RSpec.describe EE::NamespacesHelper do
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