Skip to content

detect-tests: Detect files using modified feature flags

David Dieulivol requested to merge 407366-run_specs_with_feature_flags into master

Context

Closes #407366 (closed)

What does this MR do and why?

  • maintenancerefactor Extract the code from Mappings::Base to a PredictiveTestsHelper module. This is because we need that code not only for mappings, but also for other classes outside of the mapping module (see commit)
  • featureaddition If a feature flag was changed, we check which ruby file is including that feature flag, and we add it to the list of changed files in the detect-tests CI job (see commit). The remainder of the job will then detect which frontend/backend tests should be run based on those changed files.

Does it work?

In !118038 (766b1ea2), I introduced a similar error as in the MR that caused the incident (!117519 (merged)).

  • The detect-tests job added the config/initializers/carrierwave_patch.rb file, which is the only file including the s3_multithreaded_uploads feature flag in the codebase 🎉
  • Still in that job, the spec/initializers/carrierwave_patch_spec.rb was added to the list of specs to run

How to set up and validate locally

  • Comment all of the lines except the line with Tooling::FindFilesUsingFeatureFlags
  • Run the commands below:
export RSPEC_CHANGED_FILES_PATH=input.in

cat > input.in <<FILE
config/feature_flags/development/chatops.yml
ee/config/feature_flags/development/ai_assist_ui.yml
FILE

tooling/bin/predictive_tests

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by David Dieulivol

Merge request reports

Loading