Commit e7245e1b authored by Justin Ho's avatar Justin Ho

Fix old integrations settings

After moving the old integrations to the General page,
some of them were not saving / redirecting properly.

This fixes the issue and removes stub_feature_flags calls
to make sure specs still pass.
parent 42f472da
......@@ -9,7 +9,7 @@
= _('Amazon EKS integration allows you to provision EKS clusters from GitLab.')
.settings-content
= form_for @application_setting, url: integrations_admin_application_settings_path(anchor: 'js-eks-settings'), html: { class: 'fieldset-form' } do |f|
= form_for @application_setting, url: general_admin_application_settings_path(anchor: 'js-eks-settings'), html: { class: 'fieldset-form' } do |f|
= form_errors(@application_setting)
%fieldset
......
......@@ -8,7 +8,7 @@
%p
= _('Allow rendering of PlantUML diagrams in Asciidoc documents.')
.settings-content
= form_for @application_setting, url: integrations_admin_application_settings_path(anchor: 'js-plantuml-settings'), html: { class: 'fieldset-form' } do |f|
= form_for @application_setting, url: general_admin_application_settings_path(anchor: 'js-plantuml-settings'), html: { class: 'fieldset-form' } do |f|
= form_errors(@application_setting) if expanded
%fieldset
......
......@@ -8,8 +8,7 @@
%p
= _('Configure the %{link} integration.').html_safe % { link: link_to('Snowplow', 'https://snowplowanalytics.com/', target: '_blank') }
.settings-content
= form_for @application_setting, url: integrations_admin_application_settings_path(anchor: 'js-snowplow-settings'), html: { class: 'fieldset-form' } do |f|
= form_for @application_setting, url: general_admin_application_settings_path(anchor: 'js-snowplow-settings'), html: { class: 'fieldset-form' } do |f|
= form_errors(@application_setting) if expanded
%fieldset
......
......@@ -16,7 +16,7 @@
.settings-content
= form_for @application_setting, url: integrations_admin_application_settings_path(anchor: 'js-sourcegraph-settings'), html: { class: 'fieldset-form' } do |f|
= form_for @application_setting, url: general_admin_application_settings_path(anchor: 'js-sourcegraph-settings'), html: { class: 'fieldset-form' } do |f|
= form_errors(@application_setting)
%fieldset
......
......@@ -8,8 +8,7 @@
%p
= _('Control the display of third party offers.')
.settings-content
= form_for @application_setting, url: integrations_admin_application_settings_path(anchor: 'js-third-party-offers-settings'), html: { class: 'fieldset-form' } do |f|
= form_for @application_setting, url: general_admin_application_settings_path(anchor: 'js-third-party-offers-settings'), html: { class: 'fieldset-form' } do |f|
= form_errors(@application_setting) if expanded
%fieldset
......
......@@ -14,8 +14,7 @@
%p
= _('Elasticsearch integration. Elasticsearch AWS IAM.')
.settings-content
= form_for @application_setting, url: integrations_admin_application_settings_path(anchor: 'js-elasticsearch-settings'), html: { class: 'fieldset-form' } do |f|
= form_for @application_setting, url: general_admin_application_settings_path(anchor: 'js-elasticsearch-settings'), html: { class: 'fieldset-form' } do |f|
= form_errors(@application_setting) if expanded
%fieldset
......
......@@ -10,8 +10,7 @@
%p
= _('Slack integration allows you to interact with GitLab via slash commands in a chat window.')
.settings-content
= form_for @application_setting, url: integrations_admin_application_settings_path(anchor: 'js-slack-settings'), html: { class: 'fieldset-form' } do |f|
= form_for @application_setting, url: general_admin_application_settings_path(anchor: 'js-slack-settings'), html: { class: 'fieldset-form' } do |f|
= form_errors(@application_setting) if expanded
%fieldset
......@@ -33,4 +32,3 @@
= f.text_field :slack_app_verification_token, class: 'form-control'
= f.submit _('Save changes'), class: "btn btn-success"
= feature_entry(_('Elasticsearch'),
href: integrations_admin_application_settings_path(anchor: 'js-elasticsearch-settings'),
href: general_admin_application_settings_path(anchor: 'js-elasticsearch-settings'),
doc_href: help_page_path('integration/elasticsearch'),
enabled: Gitlab::CurrentSettings.elasticsearch_search?)
......
......@@ -6,7 +6,6 @@ RSpec.describe 'Admin updates EE-only settings' do
include StubENV
before do
stub_feature_flags(instance_level_integrations: false)
stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false')
sign_in(create(:admin))
allow(License).to receive(:feature_available?).and_return(true)
......@@ -53,7 +52,7 @@ RSpec.describe 'Admin updates EE-only settings' do
context 'Elasticsearch settings' do
before do
visit integrations_admin_application_settings_path
visit general_admin_application_settings_path
page.within('.as-elasticsearch') do
click_button 'Expand'
end
......@@ -115,7 +114,7 @@ RSpec.describe 'Admin updates EE-only settings' do
end
page.within('#select2-drop') do
expect(page).to have_content(project.full_path)
expect(page).to have_content(project.name_with_namespace)
end
page.within('.as-elasticsearch') do
......@@ -135,7 +134,7 @@ RSpec.describe 'Admin updates EE-only settings' do
namespace = create(:elasticsearch_indexed_namespace).namespace
project = create(:elasticsearch_indexed_project).project
visit integrations_admin_application_settings_path
visit general_admin_application_settings_path
expect(ElasticsearchIndexedNamespace.count).to be > 0
expect(ElasticsearchIndexedProject.count).to be > 0
......@@ -165,7 +164,7 @@ RSpec.describe 'Admin updates EE-only settings' do
it 'Enable Slack application' do
allow(Gitlab).to receive(:com?).and_return(true)
visit integrations_admin_application_settings_path
visit general_admin_application_settings_path
page.within('.as-slack') do
check 'Enable Slack application'
......
......@@ -142,23 +142,12 @@ RSpec.describe Admin::ApplicationSettingsController do
end
describe 'verify panel actions' do
before do
stub_feature_flags(instance_level_integrations: false)
end
Admin::ApplicationSettingsController::VALID_SETTING_PANELS.each do |valid_action|
(Admin::ApplicationSettingsController::VALID_SETTING_PANELS - ['integrations']).each do |valid_action|
it_behaves_like 'renders correct panels' do
let(:action) { valid_action }
end
end
end
end
describe 'PATCH #integrations' do
before do
stub_feature_flags(instance_level_integrations: false)
sign_in(admin)
end
describe 'EKS integration' do
let(:application_setting) { ApplicationSetting.current }
......@@ -172,7 +161,7 @@ RSpec.describe Admin::ApplicationSettingsController do
end
it 'updates EKS settings' do
patch :integrations, params: { application_setting: settings_params }
put :update, params: { application_setting: settings_params }
expect(application_setting.eks_integration_enabled).to be_truthy
expect(application_setting.eks_account_id).to eq '123456789012'
......@@ -186,7 +175,7 @@ RSpec.describe Admin::ApplicationSettingsController do
it 'does not update the secret key' do
application_setting.update!(eks_secret_access_key: 'dummy secret key')
patch :integrations, params: { application_setting: settings_params }
put :update, params: { application_setting: settings_params }
expect(application_setting.reload.eks_secret_access_key).to eq 'dummy secret key'
end
......
......@@ -209,8 +209,7 @@ RSpec.describe 'Admin updates settings', :clean_gitlab_redis_shared_state, :do_n
context 'Integrations page' do
before do
stub_feature_flags(instance_level_integrations: false)
visit integrations_admin_application_settings_path
visit general_admin_application_settings_path
end
it 'Enable hiding third party offers' do
......
......@@ -205,11 +205,10 @@ RSpec.describe 'Gcp Cluster', :js, :do_not_mock_admin_mode do
let(:admin) { create(:admin) }
before do
stub_feature_flags(instance_level_integrations: false)
stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false')
sign_in(admin)
gitlab_enable_admin_mode_sign_in(admin)
visit integrations_admin_application_settings_path
visit general_admin_application_settings_path
end
it 'user does not see the offer' do
......
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