Skip to content

Fix RSpec split by test examples feature broken by lazy generating of JSON report with test example ids#135

Merged
ArturT merged 2 commits intomasterfrom
connect_to_queue
Nov 25, 2020
Merged

Fix RSpec split by test examples feature broken by lazy generating of JSON report with test example ids#135
ArturT merged 2 commits intomasterfrom
connect_to_queue

Conversation

@ArturT
Copy link
Copy Markdown
Member

@ArturT ArturT commented Nov 25, 2020

Fix bug

remove lazy loading of test files from disk and lazy generating of RSpec split by examples JSON report because the JSON report is needed on all parallel CI nodes to run tests properly when you use RSpec split by test examples feature.

About the bug

The bug was revealed in this CI build
https://app.circleci.com/pipelines/github/KnapsackPro/rails-app-with-knapsack_pro/83/workflows/ccfc0b61-65ca-4e8f-87d5-4e2f0ebcda90/jobs/1377/parallel-runs/0?filterBy=ALL

When CI node did not generate JSON report with test example ids for slow test files (because it connected to existing Queue on API side) then you can't run tests.

Failures:

  1) Example of slow shared examples 
     Failure/Error: raise 'Report with slow test files was not generated yet. If you have enabled split by test cases https://github.com/KnapsackPro/knapsack_pro-ruby#split-test-files-by-test-cases and you see this error it means that your tests accidentally cleaned up tmp/knapsack_pro directory. Please do not remove this directory during tests runtime!' unless File.exists?(report_path)
     
     RuntimeError:
       Report with slow test files was not generated yet. If you have enabled split by test cases https://github.com/KnapsackPro/knapsack_pro-ruby#split-test-files-by-test-cases and you see this error it means that your tests accidentally cleaned up tmp/knapsack_pro directory. Please do not remove this directory during tests runtime!
     # /home/circleci/gems/knapsack_pro-ruby/lib/knapsack_pro/slow_test_file_determiner.rb:22:in `read_from_json_report'
     # /home/circleci/gems/knapsack_pro-ruby/lib/knapsack_pro/adapters/base_adapter.rb:15:in `slow_test_file?'
     # /home/circleci/gems/knapsack_pro-ruby/lib/knapsack_pro/adapters/rspec_adapter.rb:35:in `block (2 levels) in bind_time_tracker'
     # /home/circleci/gems/knapsack_pro-ruby/lib/knapsack_pro/runners/queue/rspec_runner.rb:83:in `run_tests'
     # /home/circleci/gems/knapsack_pro-ruby/lib/knapsack_pro/runners/queue/rspec_runner.rb:36:in `run'
     # /home/circleci/gems/knapsack_pro-ruby/lib/tasks/queue/rspec.rake:6:in `block (3 levels) in <top (required)>'

Related PR

This PR introduced bug: #133

…g of RSpec split by examples test files (because it's needed to run tests on all parallel nodes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant