diff --git a/lib/gitlab/qa/component/base.rb b/lib/gitlab/qa/component/base.rb index d7afd33cd5c9d4429a7d7df97566dba79f827e3e..ce1778d4f7fe06a4ee8186f5be6f4079074307b0 100644 --- a/lib/gitlab/qa/component/base.rb +++ b/lib/gitlab/qa/component/base.rb @@ -210,7 +210,9 @@ module Gitlab "for debugging the test failure locally.") # Tailing the reconfigure logs after retries are over and before raising exception - Runtime::Logger.info("Tail of the reconfigure log file, see artifacts for full log: #{reconfigure_log_file}") + Runtime::Logger.info( + "Tail of the reconfigure log file, see artifacts for full log: #{reconfigure_log_file}" + ) Support::ShellCommand.new("tail -n 100 #{reconfigure_log_file}", stream_output: true).execute! end @@ -225,7 +227,9 @@ module Gitlab if !reconfigure_log_file.nil? && retries == 3 # Tailing the reconfigure logs after retries are over and before raising exception - Runtime::Logger.info("Tail of the reconfigure log file, see artifacts for full log: #{reconfigure_log_file}") + Runtime::Logger.info( + "Tail of the reconfigure log file, see artifacts for full log: #{reconfigure_log_file}" + ) Support::ShellCommand.new("tail -n 100 #{reconfigure_log_file}", stream_output: true).execute! end diff --git a/lib/gitlab/qa/component/gitlab.rb b/lib/gitlab/qa/component/gitlab.rb index f9890cef8906dd07714bbcfd9a7481094e07fd56..1187f3567f7a442483873c80e4eb4250a1fc004c 100644 --- a/lib/gitlab/qa/component/gitlab.rb +++ b/lib/gitlab/qa/component/gitlab.rb @@ -214,8 +214,7 @@ module Gitlab end def get_reconfigure_log_file_from_artefact - all_reconfigure_log_file = Dir["#{Runtime::Env.host_artifacts_dir}/*reconfigure.log"].sort_by { |f| File.mtime(f) } - all_reconfigure_log_file.last + Dir["#{Runtime::Env.host_artifacts_dir}/*reconfigure.log"].max_by { |f| File.mtime(f) } end private :log_file @@ -229,7 +228,8 @@ module Gitlab if line.include?('There was an error running gitlab-ctl reconfigure') Runtime::Logger.error( - "Failure while running gitlab-ctl reconfigure command. Please check the #{log_file_path} in the artefact for more info" + "Failure while running gitlab-ctl reconfigure command." \ + "Please check the #{log_file_path} in the artefact for more info" ) end @@ -368,7 +368,11 @@ module Gitlab File.open("#{Runtime::Env.host_artifacts_dir}/pg_stats.log", 'a') do |file| file << "#{Time.now.strftime('%Y-%m-%d %H:%M:%S')} -- #{name} -- Postgres statistics after test run:\n" file << "Live and dead row counts:\n" - file << @docker.exec(name, %(gitlab-psql -c 'select n_live_tup, n_dead_tup, relname from pg_stat_all_tables order by n_live_tup DESC, n_dead_tup DESC;')) + file << @docker.exec( + name, + "gitlab-psql -c 'select n_live_tup, n_dead_tup, relname from pg_stat_all_tables " \ + "order by n_live_tup DESC, n_dead_tup DESC;'" + ) file << "Cumulative user table statistics:\n" file << @docker.exec(name, %(gitlab-psql -c 'select * from pg_stat_user_tables;')) end diff --git a/lib/gitlab/qa/component/project_importer.rb b/lib/gitlab/qa/component/project_importer.rb index 63a2c2bb700f532959424461254d580c3743cb52..613da34063ea18253645c4f068a086926405925e 100644 --- a/lib/gitlab/qa/component/project_importer.rb +++ b/lib/gitlab/qa/component/project_importer.rb @@ -55,7 +55,10 @@ module Gitlab def build_import_command(script, project_url, project_name, project_path) escaped_script = script.gsub("'", "\\\\'").gsub("\n", "\\n") - "PROJECT_URL='#{project_url}' PROJECT_NAME='#{project_name}' PROJECT_PATH='#{project_path}' gitlab-rails runner $'#{escaped_script}'" + "PROJECT_URL='#{project_url}' " \ + "PROJECT_NAME='#{project_name}' " \ + "PROJECT_PATH='#{project_path}' " \ + "gitlab-rails runner $'#{escaped_script}'" end end end diff --git a/lib/gitlab/qa/release.rb b/lib/gitlab/qa/release.rb index 027dbf103083da81fda8e73a53bea6c3366d11c1..5e452c3b12eb2f949e3f7113ee9636f292616cfa 100644 --- a/lib/gitlab/qa/release.rb +++ b/lib/gitlab/qa/release.rb @@ -8,20 +8,20 @@ module Gitlab CANONICAL_REGEX = / \A (?ce|ee|jh) - (-qa)? - (:(?.+))? + (?:-qa)? + (?::(?.+))? \z /xi CUSTOM_GITLAB_IMAGE_REGEX = %r{ \A (? - (?[^/:]+(:(?\d+))?) + (?[^/:]+(?::(?\d+))?) (?.+) gitlab- (?ce|ee|jh) ) - (-qa)? - (:(?.+))? + (?:-qa)? + (?::(?.+))? \z }xi @@ -51,7 +51,7 @@ module Gitlab # version DEV_TAG_REGEX = / \A - (?\d+\.\d+(.\d+)?)\.(?\d+)-(?[A-Za-z0-9]+)\.(?[A-Za-z0-9]+) + (?\d+\.\d+(?:.\d+)?)\.(?\d+)-(?[A-Za-z0-9]+)\.(?[A-Za-z0-9]+) \z /xi diff --git a/lib/gitlab/qa/runtime/omnibus_configurations/decomposition_multiple_db.rb b/lib/gitlab/qa/runtime/omnibus_configurations/decomposition_multiple_db.rb index a93636a2b01acce452ce7c7219b421cdb71f2e4c..fcba5a49df12150140bb9fd3ec9e42ac46b40fb2 100644 --- a/lib/gitlab/qa/runtime/omnibus_configurations/decomposition_multiple_db.rb +++ b/lib/gitlab/qa/runtime/omnibus_configurations/decomposition_multiple_db.rb @@ -5,7 +5,7 @@ module Gitlab module Runtime module OmnibusConfigurations class DecompositionMultipleDb < Default - DATABASE_EXISTENCE_CHECK_COMMAND = <<~CMD.chomp + DB_EXISTENCE_CHECK_CMD = <<~CMD.chomp gitlab-psql -d gitlabhq_production_ci -c 'select 1' 2>1 > /dev/null CMD @@ -28,7 +28,7 @@ module Gitlab "sed -i 's/#gitlab_rails/gitlab_rails/g' /etc/gitlab/gitlab.rb", "gitlab-ctl reconfigure", # Create database only if it does not exist. - "#{DATABASE_EXISTENCE_CHECK_COMMAND} || gitlab-psql -c 'create database gitlabhq_production_ci owner gitlab'", + "#{DB_EXISTENCE_CHECK_CMD} || gitlab-psql -c 'create database gitlabhq_production_ci owner gitlab'", "gitlab-psql -d gitlabhq_production_ci -c 'create extension if not exists btree_gist'", "gitlab-psql -d gitlabhq_production_ci -c 'create extension if not exists pg_trgm'", # Load schema only if it does not exist. diff --git a/lib/gitlab/qa/runtime/scenario.rb b/lib/gitlab/qa/runtime/scenario.rb index 3f7cecfe2ec47cd51af7d8f56ef3348396d14da1..227957993eb1ad60f0dffd078ee534df6b247183 100644 --- a/lib/gitlab/qa/runtime/scenario.rb +++ b/lib/gitlab/qa/runtime/scenario.rb @@ -26,6 +26,12 @@ module Gitlab def method_missing(name, *) raise ArgumentError, "Scenario attribute `#{name}` not defined!" end + + def respond_to_missing?(_name, _include_private = false) + # Since method_missing raises an error for undefined attributes, + # we should return false to indicate we don't actually handle them + false + end end end end diff --git a/lib/gitlab/qa/scenario/cli_commands.rb b/lib/gitlab/qa/scenario/cli_commands.rb index 9e6afe051ced1ea65c67d334f9242f43662696e4..b2c73929992a0505448b05495174517b04422e6d 100644 --- a/lib/gitlab/qa/scenario/cli_commands.rb +++ b/lib/gitlab/qa/scenario/cli_commands.rb @@ -7,8 +7,10 @@ module Gitlab GIT_LFS_VERSION = '2.8.0' def self.git_lfs_install_commands + base_url = 'https://github.com/git-lfs/git-lfs/releases/download' + download_path = "#{base_url}/v#{GIT_LFS_VERSION}/git-lfs-linux-amd64-v#{GIT_LFS_VERSION}.tar.gz" [ - "cd /tmp ; curl -qsL https://github.com/git-lfs/git-lfs/releases/download/v#{GIT_LFS_VERSION}/git-lfs-linux-amd64-v#{GIT_LFS_VERSION}.tar.gz | tar xzvf -", + "cd /tmp ; curl -qsL #{download_path} | tar xzvf -", 'cp /tmp/git-lfs /usr/local/bin' ].freeze end diff --git a/lib/gitlab/qa/scenario/test/integration/ai_gateway_base.rb b/lib/gitlab/qa/scenario/test/integration/ai_gateway_base.rb index 3a889a9a45b505c1ae07b153d49b27bac315ba69..ed41022f9e6c44b553adcc3cf58f1109e4574ca3 100644 --- a/lib/gitlab/qa/scenario/test/integration/ai_gateway_base.rb +++ b/lib/gitlab/qa/scenario/test/integration/ai_gateway_base.rb @@ -62,7 +62,8 @@ module Gitlab gitlab.docker.exec( gitlab.name, - "ASSIGN_SEATS=#{@assign_seats} HAS_ADD_ON=#{@has_add_on} gitlab-rails runner #{SETUP_DEST_PATH}/gitlab_duo_setup.rb", + "ASSIGN_SEATS=#{@assign_seats} HAS_ADD_ON=#{@has_add_on}" \ + "gitlab-rails runner #{SETUP_DEST_PATH}/gitlab_duo_setup.rb", mask_secrets: gitlab.secrets ) end diff --git a/lib/gitlab/qa/scenario/test/integration/continuous_vulnerability_scanning.rb b/lib/gitlab/qa/scenario/test/integration/continuous_vulnerability_scanning.rb index 514c50fee7f98a373b8249aea4fd1b75770980d4..2b5ca2216ceb6d770c960529a98313eba2d2cb5d 100644 --- a/lib/gitlab/qa/scenario/test/integration/continuous_vulnerability_scanning.rb +++ b/lib/gitlab/qa/scenario/test/integration/continuous_vulnerability_scanning.rb @@ -43,13 +43,17 @@ module Gitlab end def generate_vulnerabilities - template = File.read(File.expand_path('../../../../../../fixtures/cvs/vulnerabilities_template.erb', __dir__)) + template = File.read( + File.expand_path('../../../../../../fixtures/cvs/vulnerabilities_template.erb', __dir__) + ) ERB.new(template).result(binding) end def generate_filepath File.join( - "/opt/gitlab/embedded/service/gitlab-rails/vendor/package_metadata/advisories/v2/rubygem/#{Time.now.to_i}", + "/opt/gitlab/embedded/service/gitlab-rails", + "vendor/package_metadata/advisories/v2/rubygem", + Time.now.to_i.to_s, '000000000.ndjson' ) end @@ -60,7 +64,14 @@ module Gitlab end def start_advisory_sync_worker(gitlab) - gitlab.docker.exec(gitlab.name, "PM_SYNC_IN_DEV=true gitlab-rails runner 'loop do PackageMetadata::AdvisoriesSyncWorker.new.perform; sleep 30; end' &") + gitlab.docker.exec( + gitlab.name, + "PM_SYNC_IN_DEV=true gitlab-rails runner " \ + "'loop do " \ + "PackageMetadata::AdvisoriesSyncWorker.new.perform; " \ + "sleep 30; " \ + "end' &" + ) end def run_specs(gitlab, *rspec_args) diff --git a/lib/gitlab/qa/scenario/test/integration/geo.rb b/lib/gitlab/qa/scenario/test/integration/geo.rb index 6ce61ae244315a7dd89399d1c0a655da44b7399b..ffac660556a1ff773e7a414870ca14f8b026fd18 100644 --- a/lib/gitlab/qa/scenario/test/integration/geo.rb +++ b/lib/gitlab/qa/scenario/test/integration/geo.rb @@ -35,7 +35,8 @@ module Gitlab sidekiq['concurrency'] = 2; puma['worker_processes'] = 2; OMNIBUS - primary.exec_commands = fast_ssh_key_lookup_commands + QA::Scenario::CLICommands.git_lfs_install_commands + primary.exec_commands = + fast_ssh_key_lookup_commands + QA::Scenario::CLICommands.git_lfs_install_commands primary.instance do Component::Gitlab.perform do |secondary| @@ -57,7 +58,8 @@ module Gitlab sidekiq['concurrency'] = 2; puma['worker_processes'] = 2; OMNIBUS - secondary.exec_commands += fast_ssh_key_lookup_commands + QA::Scenario::CLICommands.git_lfs_install_commands + secondary.exec_commands += + fast_ssh_key_lookup_commands + QA::Scenario::CLICommands.git_lfs_install_commands secondary.act do # TODO, we do not wait for secondary to start because of diff --git a/lib/gitlab/qa/scenario/test/integration/import.rb b/lib/gitlab/qa/scenario/test/integration/import.rb index d950dc437a9dfbf845e19cb18f3818d14631eddb..39bccd7be5e3a6d7d69dc8898045955b32087abd 100644 --- a/lib/gitlab/qa/scenario/test/integration/import.rb +++ b/lib/gitlab/qa/scenario/test/integration/import.rb @@ -36,7 +36,7 @@ module Gitlab # => will perform import from gitlab-ee:17.4.0-ee.0 to gitlab-ee # # @param [String] target_release target gitlab instance version release docker image(default) - # @param [String] source_release source gitlab instance version, if its not passed takes the target release as default + # @param [String] source_release source gitlab instance version (defaults to target_release) # @param [Array] *rspec_args rspec arguments # @return [void] def perform(target_release, source_release = nil, *rspec_args) @@ -145,8 +145,18 @@ module Gitlab # @return [Array] def build_gitlab_instances(source_release, target_release) [ - { instance: source_gitlab, name: "import-source", additional_hosts: [], release: source_release }, - { instance: target_gitlab, name: "import-target", additional_hosts: mocked_hosts, release: target_release } + { + instance: source_gitlab, + name: "import-source", + additional_hosts: [], + release: source_release + }, + { + instance: target_gitlab, + name: "import-target", + additional_hosts: mocked_hosts, + release: target_release + } ] end diff --git a/lib/gitlab/qa/scenario/test/integration/opensearch.rb b/lib/gitlab/qa/scenario/test/integration/opensearch.rb index 5c0ccb3741fb45f83dd05dfafbfb93c449ac8231..45a0f584f789dd9447381fdca452470c92341680 100644 --- a/lib/gitlab/qa/scenario/test/integration/opensearch.rb +++ b/lib/gitlab/qa/scenario/test/integration/opensearch.rb @@ -10,7 +10,8 @@ module Gitlab def initialize @gitlab_name = 'gitlab-opensearch' - # Currently the test suite that tests Advanced Search features is called 'Elasticsearch' which we hope to abstract to 'Advancedsearch' in the future + # Currently the test suite that tests Advanced Search features is called 'Elasticsearch' + # which we hope to abstract to 'Advancedsearch' in the future @spec_suite = 'QA::EE::Scenario::Test::Integration::Elasticsearch' end diff --git a/lib/gitlab/qa/scenario/test/omnibus/update_from_previous.rb b/lib/gitlab/qa/scenario/test/omnibus/update_from_previous.rb index 1faddbd9eef6de00d6fde15a971677cff9c873a1..e884c2a0aef85f8519699fe6f232e5c8746d920e 100644 --- a/lib/gitlab/qa/scenario/test/omnibus/update_from_previous.rb +++ b/lib/gitlab/qa/scenario/test/omnibus/update_from_previous.rb @@ -11,7 +11,8 @@ module Gitlab attr_reader :rspec_args # Test update from N - 1 (major|minor|patch) version to current release - # Run health check (or smoke if below 17.1.0) test suite on previous release to populate some data in database before update + # Run health check (or smoke if below 17.1.0) test suite on previous release + # to populate some data in database before update # # @example # perform(gitlab-ee:dev-tag, 15.3.0-pre, major) @@ -131,7 +132,12 @@ module Gitlab # @param [Array] rspec_args # @return [void] def run_specs(gitlab, release, rspec_args) # rubocop:disable Metrics/AbcSize - Runtime::Logger.info("Running test suite to verify update and seed data in environment") unless upgrade_path.first != release + unless upgrade_path.first != release + Runtime::Logger.info( + "Running test suite to verify update and seed data in environment" + ) + end + Runtime::Logger.info("Running test suite to verify update") unless current_release != release Component::Specs.perform do |specs| diff --git a/lib/gitlab/qa/support/gitlab_upgrade_path.rb b/lib/gitlab/qa/support/gitlab_upgrade_path.rb index 1da990ea0c18adb55e577c6991c9e5a44eaa104c..7463e10f0e8c673b05e9a9435720ef335227f28e 100644 --- a/lib/gitlab/qa/support/gitlab_upgrade_path.rb +++ b/lib/gitlab/qa/support/gitlab_upgrade_path.rb @@ -16,12 +16,15 @@ module Gitlab @logger = Runtime::Logger.logger unless current_version.match?(GitlabVersionInfo::VERSION_PATTERN) - logger.error("Invalid 'current_version' format: #{current_version}. Expected format: MAJOR.MINOR.PATCH (e.g., 17.8.2)") + logger.error( + "Invalid 'current_version' format: #{current_version}. Expected format: MAJOR.MINOR.PATCH (e.g., 17.8.2)" + ) exit 1 end @version_info = GitlabVersionInfo.new(current_version, edition) - @current_version = Gem::Version.new(current_version.match(GitlabVersionInfo::VERSION_PATTERN)[:version]) # Extract version without postfixes like pre or ee + # Extract version without postfixes like pre or ee + @current_version = Gem::Version.new(current_version.match(GitlabVersionInfo::VERSION_PATTERN)[:version]) @semver_component = semver_component @edition = edition end @@ -147,7 +150,9 @@ module Gitlab def find_latest_internal_tag(gitlab_int_reg_repo, docker) # Try to find the highest internal release tag, starting from 10 latest_internal_tag = nil - logger.info("Start searching for the latest released internal image for gitlab version: #{current_version}...") + logger.info( + "Start searching for the latest released internal image for gitlab version: #{current_version}..." + ) # Release team note: no more than 10 internal releases expected for version 10.downto(0) do |internal_num| diff --git a/lib/gitlab/qa/support/http_request.rb b/lib/gitlab/qa/support/http_request.rb index 6fa1aab698207ce24208682e303d6b34d7e3947c..ebaf058f71b3a510e83264133f51b8bafbfbe519 100644 --- a/lib/gitlab/qa/support/http_request.rb +++ b/lib/gitlab/qa/support/http_request.rb @@ -8,7 +8,14 @@ module Gitlab module Support class HttpRequest # rubocop:disable Metrics/AbcSize - def self.make_http_request(method: 'get', url: nil, params: nil, headers: {}, show_response: false, fail_on_error: true) + def self.make_http_request( + method: 'get', + url: nil, + params: nil, + headers: {}, + show_response: false, + fail_on_error: true + ) raise "URL not defined for making request. Exiting..." unless url res = HTTP.follow.method(method).call(url, json: params, headers: headers) @@ -23,7 +30,11 @@ module Gitlab end end - raise "#{method.upcase} request failed!\nCode: #{res.code}\nResponse: #{res.body}\n" if fail_on_error && !res.status.success? + if fail_on_error && !res.status.success? + raise( + "#{method.upcase} request failed!\nCode: #{res.code}\nResponse: #{res.body}\n" + ) + end res end diff --git a/lib/gitlab/qa/support/shell_command.rb b/lib/gitlab/qa/support/shell_command.rb index d21db8a69672b381e5b1568ea6e1044213543453..85870bdc68e3a65ae9ab20c2fb5cd00303740e1c 100644 --- a/lib/gitlab/qa/support/shell_command.rb +++ b/lib/gitlab/qa/support/shell_command.rb @@ -68,7 +68,12 @@ module Gitlab # # @return [void] def fail! - logger.error("Shell command output:\n#{string_output}") unless @command.include?("docker attach") || stream_output + unless @command.include?("docker attach") || stream_output + logger.error( + "Shell command output:\n#{string_output}" + ) + end + raise StatusError, "Command `#{mask_secrets(command).truncate(100)}` failed! " + "✘".red end diff --git a/rubocop/cop/gitlab/dangerous_interpolation.rb b/rubocop/cop/gitlab/dangerous_interpolation.rb index 772ad04eada45a3a9c4afb7447eb5b3a2ab5f5db..26be036f25b44771dba969033aef6b7dc0886417 100644 --- a/rubocop/cop/gitlab/dangerous_interpolation.rb +++ b/rubocop/cop/gitlab/dangerous_interpolation.rb @@ -17,7 +17,8 @@ module RuboCop class DangerousInterpolation < Base MSG = 'Sensitive variables should not be logged. ' \ - 'Please ensure that the interpolated variable is not sensitive. If not, add it to `ENV_VARIABLES` in the cop class.' + 'Please ensure that the interpolated variable is not sensitive.' \ + 'If not, add it to `ENV_VARIABLES` in the cop class.' # These values are taken from /lib/gitlab/qa/runtime/env.rb. Sensitive variables have been removed. ENV_VARIABLES = { @@ -144,7 +145,9 @@ module RuboCop PATTERN def on_send(node) - return unless heredoc_interpolation?(node) && node.parent.parent.dstr_type? && !ENV_VARIABLES.value?(node.source.split(".")[1].to_sym) + return unless heredoc_interpolation?(node) && + node.parent.parent.dstr_type? && + !ENV_VARIABLES.value?(node.source.split(".")[1].to_sym) add_offense(node) end diff --git a/spec/gitlab/qa/component/license_ops_spec.rb b/spec/gitlab/qa/component/license_ops_spec.rb index 9e3a73feba33e4bd15acd045e0bfc3f4929d077d..236d4cd9d5b181f611153eefe298dec763bd22a8 100644 --- a/spec/gitlab/qa/component/license_ops_spec.rb +++ b/spec/gitlab/qa/component/license_ops_spec.rb @@ -98,7 +98,8 @@ module Gitlab STDERR.puts "Failed to apply license" end RUBY - expected_command = "EE_LICENSE='test-key' gitlab-rails runner $'#{script.gsub("'", "\\\\'").gsub("\n", '\\n')}'" + expected_command = "EE_LICENSE='test-key' gitlab-rails runner " \ + "$'#{script.gsub("'", "\\\\'").gsub("\n", '\\n')}'" expect(license_ops.send(:build_license_command, 'test-key')).to eq(expected_command) end diff --git a/spec/gitlab/qa/component/pipeline_ops_spec.rb b/spec/gitlab/qa/component/pipeline_ops_spec.rb index 0fe580cf9198a284cb6bf09f32d1272957511d31..9c4a8800d41863b683c0f231390ff95937bd20ba 100644 --- a/spec/gitlab/qa/component/pipeline_ops_spec.rb +++ b/spec/gitlab/qa/component/pipeline_ops_spec.rb @@ -25,8 +25,15 @@ module Gitlab describe '#start' do it 'executes pipeline command with correct parameters' do - expect(docker).to receive(:exec).with('gitlab-container', /PROJECT_NAME='test-project' gitlab-rails runner/) - expect(docker).to receive(:copy).with('gitlab-container', File.join(Dir.pwd, 'support', 'pipeline'), '/tmp/setup-scripts') + expect(docker).to receive(:exec).with( + 'gitlab-container', + /PROJECT_NAME='test-project' gitlab-rails runner/ + ) + expect(docker).to receive(:copy).with( + 'gitlab-container', + File.join(Dir.pwd, 'support', 'pipeline'), + '/tmp/setup-scripts' + ) pipeline_ops.start(gitlab, project_name) end end diff --git a/spec/gitlab/qa/component/runner_ops_spec.rb b/spec/gitlab/qa/component/runner_ops_spec.rb index ac7f3d688797059aac7ce5a46b5fbd05cf98a71f..3e17eb22ebb1a697a95d4e2d66f91e752a22bf24 100644 --- a/spec/gitlab/qa/component/runner_ops_spec.rb +++ b/spec/gitlab/qa/component/runner_ops_spec.rb @@ -17,7 +17,12 @@ module Gitlab address: "http://gitlab.example.com", class: Struct.new(:name).new("Gitlab::QA::Component::Gitlab") ).tap do |gitlab| - allow(gitlab).to receive_messages(docker: docker, name: 'gitlab-instance', network: 'test-network', address: 'http://gitlab.example.com') + allow(gitlab).to receive_messages( + docker: docker, + name: 'gitlab-instance', + network: 'test-network', + address: 'http://gitlab.example.com' + ) end end @@ -140,7 +145,10 @@ module Gitlab expect(command).to include('gitlab-runner register') expect(command).to include('gitlab-runner run') - expect(command).to include("printf 'concurrent = 1\\ncheck_interval = 0\\n\\n[session_server]\\n session_timeout = 1800' > /etc/gitlab-runner/config.toml") + expect(command).to include( + "printf 'concurrent = 1\\ncheck_interval = 0\\n\\n" \ + "[session_server]\\n session_timeout = 1800' > /etc/gitlab-runner/config.toml" + ) end end end diff --git a/spec/gitlab/qa/support/gitlab_upgrade_path_spec.rb b/spec/gitlab/qa/support/gitlab_upgrade_path_spec.rb index e3d88475bbc766d4c9a02edaf0a06ea6440a5374..09fe21b4b705141ae3179b41c71271c1af7a305b 100644 --- a/spec/gitlab/qa/support/gitlab_upgrade_path_spec.rb +++ b/spec/gitlab/qa/support/gitlab_upgrade_path_spec.rb @@ -101,7 +101,9 @@ describe Gitlab::QA::Support::GitlabUpgradePath do allow(Gitlab::QA::Runtime::Logger).to receive(:logger).and_return(logger_double) allow(logger_double).to receive(:error) - expect(logger_double).to receive(:error).with("Invalid 'current_version' format: 17.8-ee. Expected format: MAJOR.MINOR.PATCH (e.g., 17.8.2)") + expect(logger_double).to receive(:error).with( + "Invalid 'current_version' format: 17.8-ee. Expected format: MAJOR.MINOR.PATCH (e.g., 17.8.2)" + ) expect { described_class.new(current_version, semver, "ee") }.to raise_error(SystemExit) end end @@ -139,7 +141,9 @@ describe Gitlab::QA::Support::GitlabUpgradePath do allow(Gitlab::QA::Runtime::Logger).to receive(:logger).and_return(logger_double) allow(logger_double).to receive(:info) - expect(logger_double).to receive(:info).with("Skipping upgrade test as next version after 18.0.3 is not yet available") + expect(logger_double).to receive(:info).with( + "Skipping upgrade test as next version after 18.0.3 is not yet available" + ) expect { upgrade_path }.to raise_error(SystemExit) end end @@ -197,7 +201,9 @@ describe Gitlab::QA::Support::GitlabUpgradePath do end it "logs an error and exits" do - expect(logger_double).to receive(:error).with("Skipping upgrade test as internal patch upgrades are not supported without dev access token") + expect(logger_double).to receive(:error).with( + "Skipping upgrade test as internal patch upgrades are not supported without dev access token" + ) expect { upgrade_path }.to raise_error(SystemExit) end end diff --git a/support/data/admin_access_token_seed.rb b/support/data/admin_access_token_seed.rb index e2fcd6efb0937b14d39ed6de2e31df525328c658..5e247465e7da9462cdda3447085eb95cb5e0f030 100644 --- a/support/data/admin_access_token_seed.rb +++ b/support/data/admin_access_token_seed.rb @@ -18,7 +18,8 @@ class AdminAccessTokenSeed admin_user.personal_access_tokens.build(token_params).tap do |pat| pat.set_token(TOKEN_VALUE) - pat.organization = Organizations::Organization.default_organization if Gitlab.version_info >= Gitlab::VersionInfo.new(17, 4) + version_check = Gitlab.version_info >= Gitlab::VersionInfo.new(17, 4) + pat.organization = Organizations::Organization.default_organization if version_check pat.save! end