Skip to content

Allow `source` and `test` definitions to be lists

Peter Leitzen requested to merge pl-source-test-array into master

Now, we map many sources to one test, one source to many tests, as well as many sources to many tests.

This enables the following redundant definitions:

mapping:
  - source: 'db/(?:post_)?migrate/(?:[0-9]+)_(.+)\.rb'
    test: 'spec/migrations/%s_spec.rb'
  - source: 'db/(?:post_)?migrate/([0-9]+)_(.+)\.rb'
    test: 'spec/migrations/%s_%s_spec.rb'

  - source: 'ee/config/metrics/.*.yml'
    test: 'ee/spec/config/metrics/every_metric_definition_spec.rb'
  - source: 'ee/lib/ee/gitlab/usage_data_counters/known_events/.*.yml'
    test: 'ee/spec/config/metrics/every_metric_definition_spec.rb'

to be consolidated as

mapping:
  - source: 'db/(?:post_)?migrate/(?:[0-9]+)_(.+)\.rb'
    test:
      - 'spec/migrations/%s_spec.rb'
      - 'spec/migrations/%s_%s_spec.rb'

  - source:
      - 'ee/config/metrics/.*.yml'
      - 'ee/lib/ee/gitlab/usage_data_counters/known_events/.*.yml'
    test: 'ee/spec/config/metrics/every_metric_definition_spec.rb'

See https://gitlab.com/gitlab-org/gitlab/-/blob/8597c87f5422ad4aefb57ccaae361f5416746909/tests.yml#L92-95 and https://gitlab.com/gitlab-org/gitlab/-/blob/8597c87f5422ad4aefb57ccaae361f5416746909/tests.yml#L114-117.

Edited by Peter Leitzen

Merge request reports

Loading