diff --git a/src/spec/integration_support/constants.rb b/src/spec/integration_support/constants.rb index 000020fc94..18d2691d33 100644 --- a/src/spec/integration_support/constants.rb +++ b/src/spec/integration_support/constants.rb @@ -3,7 +3,8 @@ module Constants BOSH_REPO_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..')) BOSH_REPO_PARENT_DIR = File.expand_path(File.join(BOSH_REPO_ROOT, '..')) BOSH_REPO_SRC_DIR = File.join(BOSH_REPO_ROOT, 'src') - INTEGRATION_BIN_DIR = File.join(BOSH_REPO_SRC_DIR, 'tmp', 'bin') + BOSH_REPO_SRC_TMP_DIR = File.join(BOSH_REPO_SRC_DIR, 'tmp') + INTEGRATION_BIN_DIR = File.join(BOSH_REPO_SRC_TMP_DIR, 'bin') SANDBOX_ASSETS_DIR = File.join(BOSH_REPO_SRC_DIR, 'spec', 'assets', 'sandbox') SANDBOX_CERTS_DIR = File.join(SANDBOX_ASSETS_DIR, 'ca', 'certs') diff --git a/src/spec/integration_support/nginx_service.rb b/src/spec/integration_support/nginx_service.rb index ad8f608c7c..5519bc24c8 100644 --- a/src/spec/integration_support/nginx_service.rb +++ b/src/spec/integration_support/nginx_service.rb @@ -91,7 +91,7 @@ def logfile_path(base_log_path) end class NginxInstaller - WORKING_DIR = File.join(IntegrationSupport::Constants::BOSH_REPO_SRC_DIR, 'tmp', 'integration-nginx-work') + WORK_DIR = File.join(IntegrationSupport::Constants::BOSH_REPO_SRC_TMP_DIR, 'nginx-work') EXECUTABLE_PATH = File.join(IntegrationSupport::Constants::INTEGRATION_BIN_DIR, 'sbin', 'nginx') def prepare @@ -110,17 +110,17 @@ def should_compile? def compile # Clean up old compiled nginx bits to stay up-to-date - FileUtils.rm_rf(WORKING_DIR) + FileUtils.rm_rf(WORK_DIR) - FileUtils.mkdir_p(WORKING_DIR) + FileUtils.mkdir_p(WORK_DIR) run_command("echo '#{RUBY_PLATFORM}' > #{IntegrationSupport::Constants::INTEGRATION_BIN_DIR}/platform") # Make sure packaging script has its own blob copies so that blobs/ directory is not affected nginx_blobs_path = File.join(IntegrationSupport::Constants::BOSH_REPO_ROOT, 'packages', 'nginx') - run_command("cp -R #{nginx_blobs_path}/. #{File.join(WORKING_DIR)}") + run_command("cp -R #{nginx_blobs_path}/. #{WORK_DIR}") - Dir.chdir(WORKING_DIR) do + Dir.chdir(WORK_DIR) do packaging_script_path = File.join(IntegrationSupport::Constants::BOSH_REPO_ROOT, 'packages', 'nginx', 'packaging') run_command("bash #{packaging_script_path}", { 'BOSH_INSTALL_TARGET' => IntegrationSupport::Constants::INTEGRATION_BIN_DIR }) end @@ -129,7 +129,10 @@ def compile private def run_command(command, environment = {}) - io = IO.popen([environment, 'bash', '-c', command]) + command = [environment, 'bash', '-c', command] + puts "Running: #{command.join(' ')}" + + io = IO.popen(command) lines = io.each_with_object("") do |line, collect| @@ -140,14 +143,14 @@ def run_command(command, environment = {}) io.close process_status = $? - raise "Command: #{command.inspect} failed with #{process_status.inspect}" unless process_status.success? + raise "Command: #{command.inspect} failed with #{process_status.inspect}" unless process_status&.success? lines end def blob_has_changed? blobs_shasum = shasum(File.join(IntegrationSupport::Constants::BOSH_REPO_ROOT, 'blobs', 'nginx')) - sandbox_copy_shasum = shasum(File.join(WORKING_DIR, 'nginx')) + sandbox_copy_shasum = shasum(File.join(WORK_DIR, 'nginx')) blobs_shasum.sort != sandbox_copy_shasum.sort end diff --git a/src/spec/integration_support/sandbox.rb b/src/spec/integration_support/sandbox.rb index b14d2e6b8e..3b408352b0 100644 --- a/src/spec/integration_support/sandbox.rb +++ b/src/spec/integration_support/sandbox.rb @@ -67,17 +67,18 @@ class Sandbox attr_accessor :trusted_certs def self.integration_spec_base_dir - File.join(IntegrationSupport::Constants::BOSH_REPO_SRC_DIR, 'tmp', 'integration-specs') + File.join(IntegrationSupport::Constants::BOSH_REPO_SRC_TMP_DIR, 'integration-specs') end private_class_method :integration_spec_base_dir def self.uaa_service - @uaa_service ||= UaaService.new(uaa_root: File.join(integration_spec_base_dir, 'uaa_root')) + @uaa_service ||= UaaService.new(uaa_root: File.join(integration_spec_base_dir, "uaa_root-pid-#{Process.pid}")) end private_class_method :uaa_service + def self.sandbox_pid_root - File.join(integration_spec_base_dir, "pid-#{Process.pid}-sandbox") + File.join(integration_spec_base_dir, "sandbox-pid-#{Process.pid}") end def self.sandbox_tmp_dir