diff options
Diffstat (limited to 'qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_file_size_spec.rb')
-rw-r--r-- | qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_file_size_spec.rb | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_file_size_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_file_size_spec.rb index 812a7bae6c3..0e4aa67162f 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_file_size_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_file_size_spec.rb @@ -1,32 +1,27 @@ # frozen_string_literal: true module QA - RSpec.describe 'Create', :requires_admin do + # This test modifies an instance level setting, + # so skipping on live envs to avoid random transient issues + RSpec.describe 'Create', :requires_admin, :skip_live_env do describe 'push after setting the file size limit via admin/application_settings' do - # Note: The file size limits in this test should be greater than the limits in - # ee/browser_ui/3_create/repository/push_rules_spec to prevent that test from - # triggering the limit set in this test (which can happen on Staging where the - # tests are run in parallel). - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/218620#note_361634705 - include Support::API - before(:context) do - @project = Resource::Project.fabricate_via_api! do |p| + let!(:project) do + Resource::Project.fabricate_via_api! do |p| p.name = 'project-test-push-limit' p.initialize_with_readme = true end - - @api_client = Runtime::API::Client.as_admin end after(:context) do - # need to set the default value after test - # default value for file size limit is empty set_file_size_limit(nil) end - it 'push successful when the file size is under the limit', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347758' do + it( + 'push successful when the file size is under the limit', + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347758' + ) do set_file_size_limit(5) retry_on_fail do @@ -36,7 +31,10 @@ module QA end end - it 'push fails when the file size is above the limit', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347759' do + it( + 'push fails when the file size is above the limit', + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347759' + ) do set_file_size_limit(2) retry_on_fail do @@ -46,7 +44,7 @@ module QA end def set_file_size_limit(limit) - request = Runtime::API::Request.new(@api_client, '/application/settings') + request = Runtime::API::Request.new(Runtime::API::Client.as_admin, '/application/settings') response = put request.url, receive_max_input_size: limit expect(response.code).to eq(200) @@ -56,13 +54,13 @@ module QA def push_new_file(file_name, wait_for_push: true) commit_message = 'Adding a new file' output = Resource::Repository::Push.fabricate! do |p| - p.repository_http_uri = @project.repository_http_location.uri + p.repository_http_uri = project.repository_http_location.uri p.file_name = file_name p.file_content = SecureRandom.random_bytes(3000000) p.commit_message = commit_message p.new_branch = false end - @project.wait_for_push commit_message + project.wait_for_push commit_message output end @@ -77,10 +75,8 @@ module QA # under a minute, i.e., in fewer than 6 attempts with a 10 second sleep # between attempts. # See https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/30233#note_188616863 - def retry_on_fail - Support::Retrier.retry_on_exception(max_attempts: 6, reload_page: nil, sleep_interval: 10) do - yield - end + def retry_on_fail(&block) + Support::Retrier.retry_on_exception(max_attempts: 6, reload_page: false, sleep_interval: 10, &block) end end end |