From d5e8bd790b95d794c16783a095ffc1d3e8a9b259 Mon Sep 17 00:00:00 2001 From: Martin Brennan Date: Tue, 24 Oct 2023 12:43:14 +1000 Subject: [PATCH] DEV: Re-enable minio specs by pre-installing minio binary before test run (#24050) This fixes a similar issue to 8b3eca0 where an Errno::ETXTBSY error was raised because the minio_runner gem was trying to install the binary across multiple processes in rspec. If we just make sure the latest version is installed before the tests run, this shouldn't happen, since MinioRunner.start will not do any further attempts at installation if the latest version is installed. --- .github/workflows/tests.yml | 4 ++++ .../discourse/app/components/avatar-uploader.hbs | 2 +- spec/support/system_helpers.rb | 2 -- spec/system/s3_secure_uploads_spec.rb | 8 +++++++- spec/system/s3_uploads_spec.rb | 2 +- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 96c35cddf7e..98a233fd668 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -220,6 +220,10 @@ jobs: if: matrix.build_type == 'system' run: bin/ember-cli --build + - name: Ensure latest minio binary installed for System Tests + if: matrix.build_type == 'system' + run: bundle exec ruby script/install_minio_binaries.rb + - name: Core System Tests if: matrix.build_type == 'system' && matrix.target == 'core' run: RAILS_ENABLE_TEST_LOG=1 RAILS_TEST_LOG_LEVEL=error PARALLEL_TEST_PROCESSORS=4 bin/turbo_rspec --use-runtime-info --profile=50 --verbose --format documentation spec/system diff --git a/app/assets/javascripts/discourse/app/components/avatar-uploader.hbs b/app/assets/javascripts/discourse/app/components/avatar-uploader.hbs index 97fb5cba170..d410bde3f23 100644 --- a/app/assets/javascripts/discourse/app/components/avatar-uploader.hbs +++ b/app/assets/javascripts/discourse/app/components/avatar-uploader.hbs @@ -11,7 +11,7 @@ @disabled={{this.uploading}} @action={{this.chooseImage}} @title="user.change_avatar.upload_title" - class="btn-default" + class="btn-default avatar-uploader__button" data-uploaded={{this.customAvatarUploaded}} data-avatar-upload-id={{this.uploadedAvatarId}} /> diff --git a/spec/support/system_helpers.rb b/spec/support/system_helpers.rb index 87e11c8b0f9..d2e0a4c2748 100644 --- a/spec/support/system_helpers.rb +++ b/spec/support/system_helpers.rb @@ -199,8 +199,6 @@ module SystemHelpers end def skip_unless_s3_system_specs_enabled! - skip("(martin) temporarily skipping minio tests because of parralel binary issues") - 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.", diff --git a/spec/system/s3_secure_uploads_spec.rb b/spec/system/s3_secure_uploads_spec.rb index 1ab9bcaa276..44d3390553a 100644 --- a/spec/system/s3_secure_uploads_spec.rb +++ b/spec/system/s3_secure_uploads_spec.rb @@ -110,7 +110,13 @@ describe "Uploading files in the composer to S3", type: :system do # Extra wait time is added because the job can slow down the processing of the request. img = first_post_img(wait: 10) - expect(img["src"]).not_to include("/secure-uploads") + + # At first the image will be secure when created via the composer, usually the + # CookedPostProcessor job fixes this but running it immediately when creating the + # post doesn't work in the test, so we need to rebake here to get the correct result. + expect(page).to have_css("img[src*='secure-uploads']") + Post.last.rebake! + expect(page).not_to have_css("img[src*='secure-uploads']", wait: 5) topic = topic_page.current_topic expect(topic.first_post.uploads.first.secure).to eq(false) end diff --git a/spec/system/s3_uploads_spec.rb b/spec/system/s3_uploads_spec.rb index a1f9090be22..71cdc10b77e 100644 --- a/spec/system/s3_uploads_spec.rb +++ b/spec/system/s3_uploads_spec.rb @@ -22,7 +22,7 @@ describe "Uploading files in the composer to S3", type: :system do attach_file(File.absolute_path(file_from_fixtures("logo.jpg"))) do find("#avatar-uploader").click end - expect(page).to have_css(".avatar-uploader label[data-uploaded]") + expect(page).to have_css(".avatar-uploader .avatar-uploader__button[data-uploaded]") modal.click_primary_button expect(modal).to be_closed expect(page).to have_css(