From b16ee077ffa68f64ef5901b17983f110fc61385d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Tue, 16 Apr 2019 18:57:24 +0200 Subject: Better document the current states of our testing levels MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémy Coutable --- spec/rack_servers/configs/puma.rb | 32 -------------------------------- spec/rack_servers/puma_spec.rb | 20 ++++++++++---------- 2 files changed, 10 insertions(+), 42 deletions(-) delete mode 100644 spec/rack_servers/configs/puma.rb (limited to 'spec/rack_servers') diff --git a/spec/rack_servers/configs/puma.rb b/spec/rack_servers/configs/puma.rb deleted file mode 100644 index d6b6d83d648..00000000000 --- a/spec/rack_servers/configs/puma.rb +++ /dev/null @@ -1,32 +0,0 @@ -# frozen_string_literal: true - -# Note: this file is used for testing puma in `spec/rack_servers/puma_spec.rb` only -# Note: as per the convention in `config/puma.example.development.rb`, -# this file will replace `/home/git` with the actual working directory - -directory '/home/git' -threads 1, 10 -queue_requests false -pidfile '/home/git/gitlab/tmp/pids/puma.pid' -bind 'unix:///home/git/gitlab/tmp/tests/puma.socket' -workers 1 -preload_app! -worker_timeout 60 - -require_relative "/home/git/gitlab/lib/gitlab/cluster/lifecycle_events" -require_relative "/home/git/gitlab/lib/gitlab/cluster/puma_worker_killer_initializer" - -before_fork do - Gitlab::Cluster::PumaWorkerKillerInitializer.start @config.options - Gitlab::Cluster::LifecycleEvents.do_before_fork -end - -Gitlab::Cluster::LifecycleEvents.set_puma_options @config.options -on_worker_boot do - Gitlab::Cluster::LifecycleEvents.do_worker_start - File.write('/home/git/gitlab/tmp/tests/puma-worker-ready', Process.pid) -end - -on_restart do - Gitlab::Cluster::LifecycleEvents.do_master_restart -end diff --git a/spec/rack_servers/puma_spec.rb b/spec/rack_servers/puma_spec.rb index 891df4f1a66..8290473821c 100644 --- a/spec/rack_servers/puma_spec.rb +++ b/spec/rack_servers/puma_spec.rb @@ -1,20 +1,20 @@ # frozen_string_literal: true -require 'fileutils' +require 'spec_helper' +require 'fileutils' require 'excon' -require 'spec_helper' - describe 'Puma' do before(:all) do - project_root = File.expand_path('../..', __dir__) - - config_lines = File.read('spec/rack_servers/configs/puma.rb') - .gsub('/home/git/gitlab', project_root) - .gsub('/home/git', project_root) - - config_path = File.join(project_root, "tmp/tests/puma.rb") + project_root = Rails.root.to_s + config_lines = File.read(Rails.root.join('config/puma.example.development.rb')) + .gsub('config.ru', File.join(__dir__, 'configs/config.ru')) + .gsub('workers 2', 'workers 1') + .gsub('/home/git/gitlab.socket', File.join(project_root, 'tmp/tests/puma.socket')) + .gsub('on_worker_boot do', "on_worker_boot do\nFile.write('#{File.join(project_root, 'tmp/tests/puma-worker-ready')}', Process.pid)") + .gsub(%r{/home/git(/gitlab)?}, project_root) + config_path = File.join(project_root, 'tmp/tests/puma.rb') @socket_path = File.join(project_root, 'tmp/tests/puma.socket') File.write(config_path, config_lines) -- cgit v1.2.3