knapsack
knapsack copied to clipboard
Warn and return when `node_tests` are empty
Context
When working on #103 an edge case was observed where a pattern (or list in #103) resulting allocator.node_tests
when smaller then the number of CI_NODES
results in 1-n nodes executing the complete test suite.
relevant line in rspec runner (bug applies to all runners):
https://github.com/KnapsackPro/knapsack/blob/d9abb662f6a5d5473c34af4d63ccdd077ee14935/lib/knapsack/runners/rspec_runner.rb#L15
This interpolated string, with an empty node_tests
array results in the following command being executed (assuming a test-dir of spec
and no additional args):
bundle exec rspec --default-path spec --
This behaves the same as bundle exec rspec --default-path spec
which executes all specs.
Solution
This PR adds a guard clause to all runners to return whenever the node_tests
is empty for a given node. This seems to be the desired behavior: there are no specs left to execute for this node, so do nothing.
@ArturT could you review this ?
Hi @alexanderjeurissen
Note for myself to review it later:
It looks like this PR depends on the source code from the https://github.com/KnapsackPro/knapsack/pull/103#issuecomment-821987956 We need to decide first what to do with that PR before merging this PR.