Edge-case when only a file under `data/whats_new/\w*.yml` is edited, `rspec:coverage` fails before the MR is approved
When only a file under data/whats_new/\w*.yml is edited, rspec:coverage fails before the MR is approved for the following reason:
-
detect-testsproperly map thedata/whats_new/\w*.ymlpattern tospec/lib/release_highlights/validator_spec.rb: https://gitlab.com/gitlab-org/gitlab/-/jobs/2231283646#L63 - Only
rspec system minimaljobs are run sincerspec unit pg12 minimal(which extend from.rails:rules:ee-and-foss-unit:minimal) only run forbackend-patternswhich doesn't includedata/whats_new/\w*.yml -
rspec system minimaljobs don't actually run any tests as the only test to run isspec/lib/release_highlights/validator_spec.rbin this particular case -
rspec:coveragedownload therspec system minimalartifacts but doesn't have any coverage file to process and fails with
$ run_timed_command "bundle exec scripts/merge-simplecov"
$ bundle exec scripts/merge-simplecov
bundler: failed to load command: scripts/merge-simplecov (scripts/merge-simplecov)
/builds/gitlab-org/gitlab/vendor/ruby/2.7.0/gems/simplecov-0.21.2/lib/simplecov.rb:87:in `collate': There are no reports to be merged (RuntimeError)
from scripts/merge-simplecov:8:in `<top (required)>'
from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.6/lib/bundler/cli/exec.rb:58:in `load'
from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.6/lib/bundler/cli/exec.rb:58:in `kernel_load'
from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.6/lib/bundler/cli/exec.rb:23:in `run'
from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.6/lib/bundler/cli.rb:484:in `exec'
from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.6/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.6/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.6/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.6/lib/bundler/cli.rb:31:in `dispatch'
from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.6/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.6/lib/bundler/cli.rb:25:in `start'
from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.6/exe/bundle:48:in `block in <top (required)>'
from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.6/lib/bundler/friendly_errors.rb:103:in `with_friendly_errors'
from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.6/exe/bundle:36:in `<top (required)>'
from /usr/local/bin/bundle:23:in `load'
from /usr/local/bin/bundle:23:in `<main>'
Potential solutions
- Add
data/whats_new/\w*.ymltobackend-patternsso thatrspec unit minimaljobs run in that case - Make
rspec:coveragegracefully exit when there's no coverage files to process