diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-20 16:18:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-20 16:18:24 +0300 |
commit | 0653e08efd039a5905f3fa4f6e9cef9f5d2f799c (patch) | |
tree | 4dcc884cf6d81db44adae4aa99f8ec1233a41f55 /spec/features/admin | |
parent | 744144d28e3e7fddc117924fef88de5d9674fe4c (diff) |
Add latest changes from gitlab-org/gitlab@14-3-stable-eev14.3.0-rc42
Diffstat (limited to 'spec/features/admin')
4 files changed, 104 insertions, 36 deletions
diff --git a/spec/features/admin/admin_runners_spec.rb b/spec/features/admin/admin_runners_spec.rb index 54c07985a21..8053be89ffc 100644 --- a/spec/features/admin/admin_runners_spec.rb +++ b/spec/features/admin/admin_runners_spec.rb @@ -356,6 +356,7 @@ RSpec.describe "Admin Runners" do assigned_project = page.find('[data-testid="assigned-projects"]') + expect(page).to have_content('Runner assigned to project.') expect(assigned_project).to have_content(@project2.path) end end @@ -399,13 +400,14 @@ RSpec.describe "Admin Runners" do visit admin_runner_path(runner) end - it 'enables specific runner for project' do + it 'removed specific runner from project' do within '[data-testid="assigned-projects"]' do click_on 'Disable' end new_runner_project = page.find('[data-testid="unassigned-projects"]') + expect(page).to have_content('Runner unassigned from project.') expect(new_runner_project).to have_content(@project1.path) end end diff --git a/spec/features/admin/admin_sees_background_migrations_spec.rb b/spec/features/admin/admin_sees_background_migrations_spec.rb index 11823195310..94fb3a0314f 100644 --- a/spec/features/admin/admin_sees_background_migrations_spec.rb +++ b/spec/features/admin/admin_sees_background_migrations_spec.rb @@ -10,7 +10,7 @@ RSpec.describe "Admin > Admin sees background migrations" do let_it_be(:finished_migration) { create(:batched_background_migration, table_name: 'finished', status: :finished) } before_all do - create(:batched_background_migration_job, batched_migration: failed_migration, batch_size: 30, status: :succeeded) + create(:batched_background_migration_job, batched_migration: failed_migration, batch_size: 10, min_value: 6, max_value: 15, status: :failed, attempts: 3) end before do @@ -53,22 +53,35 @@ RSpec.describe "Admin > Admin sees background migrations" do end end - it 'can view failed migrations' do - visit admin_background_migrations_path + context 'when there are failed migrations' do + before do + allow_next_instance_of(Gitlab::BackgroundMigration::BatchingStrategies::PrimaryKeyBatchingStrategy) do |batch_class| + allow(batch_class).to receive(:next_batch).with(anything, anything, batch_min_value: 6, batch_size: 5).and_return([6, 10]) + end + end - within '#content-body' do - tab = find_link 'Failed' - tab.click + it 'can view and retry them' do + visit admin_background_migrations_path - expect(page).to have_current_path(admin_background_migrations_path(tab: 'failed')) - expect(tab[:class]).to include('gl-tab-nav-item-active', 'gl-tab-nav-item-active-indigo') + within '#content-body' do + tab = find_link 'Failed' + tab.click - expect(page).to have_selector('tbody tr', count: 1) + expect(page).to have_current_path(admin_background_migrations_path(tab: 'failed')) + expect(tab[:class]).to include('gl-tab-nav-item-active', 'gl-tab-nav-item-active-indigo') + + expect(page).to have_selector('tbody tr', count: 1) + + expect(page).to have_content(failed_migration.job_class_name) + expect(page).to have_content(failed_migration.table_name) + expect(page).to have_content('0.00%') + expect(page).to have_content(failed_migration.status.humanize) - expect(page).to have_content(failed_migration.job_class_name) - expect(page).to have_content(failed_migration.table_name) - expect(page).to have_content('30.00%') - expect(page).to have_content(failed_migration.status.humanize) + click_button('Retry') + expect(page).not_to have_content(failed_migration.job_class_name) + expect(page).not_to have_content(failed_migration.table_name) + expect(page).not_to have_content('0.00%') + end end end diff --git a/spec/features/admin/admin_settings_spec.rb b/spec/features/admin/admin_settings_spec.rb index 4a0f7ccbb0a..b25fc9f257a 100644 --- a/spec/features/admin/admin_settings_spec.rb +++ b/spec/features/admin/admin_settings_spec.rb @@ -269,10 +269,7 @@ RSpec.describe 'Admin updates settings' do end context 'Integrations page' do - let(:mailgun_events_receiver_enabled) { true } - before do - stub_feature_flags(mailgun_events_receiver: mailgun_events_receiver_enabled) visit general_admin_application_settings_path end @@ -286,26 +283,16 @@ RSpec.describe 'Admin updates settings' do expect(current_settings.hide_third_party_offers).to be true end - context 'when mailgun_events_receiver feature flag is enabled' do - it 'enabling Mailgun events', :aggregate_failures do - page.within('.as-mailgun') do - check 'Enable Mailgun event receiver' - fill_in 'Mailgun HTTP webhook signing key', with: 'MAILGUN_SIGNING_KEY' - click_button 'Save changes' - end - - expect(page).to have_content 'Application settings saved successfully' - expect(current_settings.mailgun_events_enabled).to be true - expect(current_settings.mailgun_signing_key).to eq 'MAILGUN_SIGNING_KEY' + it 'enabling Mailgun events', :aggregate_failures do + page.within('.as-mailgun') do + check 'Enable Mailgun event receiver' + fill_in 'Mailgun HTTP webhook signing key', with: 'MAILGUN_SIGNING_KEY' + click_button 'Save changes' end - end - - context 'when mailgun_events_receiver feature flag is disabled' do - let(:mailgun_events_receiver_enabled) { false } - it 'does not have mailgun' do - expect(page).not_to have_selector('.as-mailgun') - end + expect(page).to have_content 'Application settings saved successfully' + expect(current_settings.mailgun_events_enabled).to be true + expect(current_settings.mailgun_signing_key).to eq 'MAILGUN_SIGNING_KEY' end end @@ -559,6 +546,50 @@ RSpec.describe 'Admin updates settings' do expect(current_settings.dns_rebinding_protection_enabled).to be false end + it 'changes User and IP Rate Limits settings' do + visit network_admin_application_settings_path + + page.within('.as-ip-limits') do + check 'Enable unauthenticated API request rate limit' + fill_in 'Maximum unauthenticated API requests per rate limit period per IP', with: 100 + fill_in 'Unauthenticated API rate limit period in seconds', with: 200 + + check 'Enable unauthenticated web request rate limit' + fill_in 'Maximum unauthenticated web requests per rate limit period per IP', with: 300 + fill_in 'Unauthenticated web rate limit period in seconds', with: 400 + + check 'Enable authenticated API request rate limit' + fill_in 'Maximum authenticated API requests per rate limit period per user', with: 500 + fill_in 'Authenticated API rate limit period in seconds', with: 600 + + check 'Enable authenticated web request rate limit' + fill_in 'Maximum authenticated web requests per rate limit period per user', with: 700 + fill_in 'Authenticated web rate limit period in seconds', with: 800 + + fill_in 'Plain-text response to send to clients that hit a rate limit', with: 'Custom message' + + click_button 'Save changes' + end + + expect(page).to have_content "Application settings saved successfully" + + expect(current_settings).to have_attributes( + throttle_unauthenticated_api_enabled: true, + throttle_unauthenticated_api_requests_per_period: 100, + throttle_unauthenticated_api_period_in_seconds: 200, + throttle_unauthenticated_enabled: true, + throttle_unauthenticated_requests_per_period: 300, + throttle_unauthenticated_period_in_seconds: 400, + throttle_authenticated_api_enabled: true, + throttle_authenticated_api_requests_per_period: 500, + throttle_authenticated_api_period_in_seconds: 600, + throttle_authenticated_web_enabled: true, + throttle_authenticated_web_requests_per_period: 700, + throttle_authenticated_web_period_in_seconds: 800, + rate_limiting_response_text: 'Custom message' + ) + end + it 'changes Issues rate limits settings' do visit network_admin_application_settings_path @@ -570,6 +601,20 @@ RSpec.describe 'Admin updates settings' do expect(page).to have_content "Application settings saved successfully" expect(current_settings.issues_create_limit).to eq(0) end + + it 'changes Files API rate limits settings' do + visit network_admin_application_settings_path + + page.within('[data-testid="files-limits-settings"]') do + check 'Enable unauthenticated API request rate limit' + fill_in 'Max unauthenticated API requests per period per IP', with: 10 + click_button 'Save changes' + end + + expect(page).to have_content "Application settings saved successfully" + expect(current_settings.throttle_unauthenticated_files_api_enabled).to be true + expect(current_settings.throttle_unauthenticated_files_api_requests_per_period).to eq(10) + end end context 'Preferences page' do diff --git a/spec/features/admin/admin_users_impersonation_tokens_spec.rb b/spec/features/admin/admin_users_impersonation_tokens_spec.rb index 7466150addf..0966032ff37 100644 --- a/spec/features/admin/admin_users_impersonation_tokens_spec.rb +++ b/spec/features/admin/admin_users_impersonation_tokens_spec.rb @@ -42,7 +42,7 @@ RSpec.describe 'Admin > Users > Impersonation Tokens', :js do click_on "Create impersonation token" expect(active_impersonation_tokens).to have_text(name) - expect(active_impersonation_tokens).to have_text('In') + expect(active_impersonation_tokens).to have_text('in') expect(active_impersonation_tokens).to have_text('api') expect(active_impersonation_tokens).to have_text('read_user') expect(PersonalAccessTokensFinder.new(impersonation: true).execute.count).to equal(1) @@ -59,6 +59,14 @@ RSpec.describe 'Admin > Users > Impersonation Tokens', :js do expect(active_impersonation_tokens).to have_text(impersonation_token.name) expect(active_impersonation_tokens).not_to have_text(personal_access_token.name) + expect(active_impersonation_tokens).to have_text('in') + end + + it 'shows absolute times' do + admin.update!(time_display_relative: false) + visit admin_user_impersonation_tokens_path(user_id: user.username) + + expect(active_impersonation_tokens).to have_text(personal_access_token.expires_at.strftime('%b %d')) end end |