From 3338e66f986cdb7e840c4d10d22110e0d439956f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Busqu=C3=A9?= Date: Thu, 26 Jan 2023 11:49:06 +0100 Subject: [PATCH] Fix CI only testing with the legacy event system adapter From https://github.com/solidusio/solidus/pull/4666 all CI jobs have been running with the legacy event system. We were defaulting the `legacy` parameter to `0`, which we copied over to the `USE_LEGACY_EVENTS` environment variable. However, the test suite was checking for the mere existence of the environment variable to select the legacy adapter and not for an actual `1` value. We are now: - Renaming the `legacy` parameter to `legacy_events` to be clearer. - Making the parameter a boolean one, defaulting to false. - Checking that `USE_LEGACY_EVENTS` is the string `"true"` before selecting the legacy adapter. - Using the legacy adapter for the job on Ruby 2.7 & Rails 6.0. - Adding `-legacy_events` to the job name when selected. (cherry picked from commit f1090395ba9e634538e996e242b8a507d9255490) --- .circleci/config.yml | 16 ++++++++-------- core/lib/spree/testing_support/dummy_app.rb | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e7b6437495..605f376913 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -263,9 +263,9 @@ jobs: paperclip: type: boolean default: true - legacy: - type: string - default: "0" + legacy_events: + type: boolean + default: false executor: name: << parameters.database >> ruby: << parameters.ruby >> @@ -273,7 +273,7 @@ jobs: environment: DISABLE_ACTIVE_STORAGE: << parameters.paperclip >> RAILS_VERSION: "~> << parameters.rails >>" - USE_LEGACY_EVENTS: << parameters.legacy >> + USE_LEGACY_EVENTS: << parameters.legacy_events >> BUILDKITE_ANALYTICS_EXECUTION_NAME_PREFIX: "(<< parameters.ruby >>:<< parameters.rails >>:<< parameters.database >>:<< parameters.paperclip >>)" steps: - setup @@ -333,15 +333,15 @@ workflows: # https://www.fastruby.io/blog/ruby/rails/versions/compatibility-table.html. - test_solidus: context: slack-secrets - name: &name "test-rails-<>-ruby-<>-<>-<<#matrix.paperclip>>paperclip<><<^matrix.paperclip>>activestorage<>" - matrix: { parameters: { rails: ['7.0'], ruby: ['3.1', '3.2'], database: ['mysql', 'sqlite', 'postgres'], paperclip: [true, false] } } + name: &name "test-rails-<>-ruby-<>-<>-<<#matrix.paperclip>>paperclip<><<^matrix.paperclip>>activestorage<><<#matrix.legacy_events>>-legacy_events<>" + matrix: { parameters: { rails: ['7.0'], ruby: ['3.1', '3.2'], database: ['mysql', 'sqlite', 'postgres'], paperclip: [true, false], legacy_events: [false] } } - test_solidus: context: slack-secrets name: *name - matrix: { parameters: { rails: ['6.1'], ruby: ['2.7', '3.0', '3.1'], database: ['sqlite'], paperclip: [false] } } + matrix: { parameters: { rails: ['6.1'], ruby: ['2.7', '3.0', '3.1'], database: ['sqlite'], paperclip: [false], legacy_events: [false] } } - test_solidus: context: slack-secrets name: *name - matrix: { parameters: { rails: ['6.0'], ruby: ['2.7'], database: ['sqlite'], paperclip: [true] } } + matrix: { parameters: { rails: ['6.0'], ruby: ['2.7'], database: ['sqlite'], paperclip: [true], legacy_events: [true] } } - dev_tools: context: slack-secrets diff --git a/core/lib/spree/testing_support/dummy_app.rb b/core/lib/spree/testing_support/dummy_app.rb index 6fdc5ace42..ffc4cf619a 100644 --- a/core/lib/spree/testing_support/dummy_app.rb +++ b/core/lib/spree/testing_support/dummy_app.rb @@ -138,7 +138,7 @@ class Application < ::Rails::Application Spree.user_class = 'Spree::LegacyUser' Spree.load_defaults(Spree.solidus_version) Spree.config do |config| - config.use_legacy_events = ENV['USE_LEGACY_EVENTS'].present? + config.use_legacy_events = (ENV['USE_LEGACY_EVENTS'] == 'true') if ENV['DISABLE_ACTIVE_STORAGE'] config.image_attachment_module = 'Spree::Image::PaperclipAttachment'