KnapsackPro / knapsack_pro-ruby

Knapsack Pro gem splits tests across parallel CI nodes and makes sure that tests run in optimal time
https://knapsackpro.com
MIT License
132 stars 27 forks source link

Knapsack v7 ignores run options defined in spec_helpers. #250

Closed mikdiet closed 6 months ago

mikdiet commented 6 months ago

I'm upgrading Knapsack 6.0.4 -> 7.1.0.

I have a number of tests I don't want to run on CI, they are labeled with :manual tag.

I also have this option in spec/spec_helper.rb:

RSpec.configure do |config|
  ...
  config.filter_run_excluding :manual
  ...
end

Knapsack 6 ignored these tests, I've seen in logs:

Run options: exclude {:manual=>true}

But Knapsack 7 tries to run these tests, and I don't see any "Run options" in logs.

mikdiet commented 6 months ago

I didn't change command that runs Knapsack, it looks like

      bundle exec knapsack_pro queue:rspec "\
                        --profile 10 \
                        --format RspecJunitFormatter \
                        --out test_results/rspec.xml \
                        --no-color --format progress \
                        --require rails_helper --require packs/rails/rspec"
ArturT commented 6 months ago

Please exclude tests explicitly when you use the knapsack_pro v7.x gem in Queue Mode.

You can pass --tag ~manual to the knapsack command.

      bundle exec knapsack_pro queue:rspec "\
                        --profile 10 \
                        --format RspecJunitFormatter \
                        --out test_results/rspec.xml \
                        --no-color --format progress \
                        --tag ~manual \
                        --require rails_helper --require packs/rails/rspec"

It is useful if you want to exclude only a subset of test examples within a test file.

If you want to exclude all test examples from the given test file, it is better to exclude a whole test file instead of tagged test examples. You can use KNAPSACK_PRO_TEST_FILE_EXCLUDE_PATTERN so that the excluded test files are not loaded and not distributed between parallel nodes.

mikdiet commented 6 months ago

Thank you, it helped a lot!