From 78ed8ede8afa45969edcf1e85966a3d971cecf77 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Wed, 16 Oct 2024 10:40:58 +0100 Subject: [PATCH] DEV: Improve isolation and concurrency for minio-based upload specs (#29216) - Uses a temporary, clean, per-test-process directory for minio data - Runs a separate minio instance for each test process - Unskips minio-based tests in CI --- spec/rails_helper.rb | 10 ++++++++++ spec/support/system_helpers.rb | 7 ------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index e66ba681705..af9d2aaa27a 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -325,6 +325,16 @@ RSpec.configure do |config| ["discoursetest"] end ) + + test_i = ENV["TEST_ENV_NUMBER"].to_i + + data_dir = "#{Rails.root}/tmp/test_data_#{test_i}/minio" + FileUtils.rm_rf(data_dir) + FileUtils.mkdir_p(data_dir) + minio_runner_config.minio_data_directory = data_dir + + minio_runner_config.minio_port = 9_000 + 2 * test_i + minio_runner_config.minio_console_port = 9_001 + 2 * test_i end WebMock.disable_net_connect!( diff --git a/spec/support/system_helpers.rb b/spec/support/system_helpers.rb index b7d5030e226..2cdf2d2c3f1 100644 --- a/spec/support/system_helpers.rb +++ b/spec/support/system_helpers.rb @@ -144,13 +144,6 @@ module SystemHelpers end def skip_unless_s3_system_specs_enabled! - if ENV["CI"] - return( - skip( - "S3 system specs are temporarily disabled in this environment to address parallel spec issues", - ) - ) - end if !ENV["CI"] && !ENV["RUN_S3_SYSTEM_SPECS"] skip( "S3 system specs are disabled in this environment, set CI=1 or RUN_S3_SYSTEM_SPECS=1 to enable them.",