Skip to content

Fix: save_state! should only modify state field

Terri Chu requested to merge tchu-fix-migration-record-save-state into master

What does this MR do and why?

Why: save_state! is overwriting fields other than state causing the migration document to lose name, started_at, fields during execution

What:

  • only write out state field but keep everything else in the document
  • defines the name field for the migration mapping (it was causing test failures)
  • fix rubocop violations
  • update specs to move off elastic_clean to elastic_delete_by_query trait, reduced test runtime locally from 15 minutes to 1.5 minutes. I chose elastic_delete_by_query to avoid flaky tests. The flaky tests were due to not cleaning up the indexed documents between example runs.

Screenshots or screen recordings

N/A

before (:elastic_clean)

➜ be rspec ee/spec/models/elastic/migration_record_spec.rb
Run options: include {:focus=>true}

All examples were filtered out; ignoring {:focus=>true}

Test environment set up in 6.63073 seconds
....................................

Finished in 22 minutes 58 seconds (files took 15.19 seconds to load)
36 examples, 0 failures

after (:elastic_delete_by_query)

❯ be rspec ee/spec/models/elastic/migration_record_spec.rb
Run options: include {:focus=>true}

All examples were filtered out; ignoring {:focus=>true}

Test environment set up in 6.667638 seconds
....................................

Finished in 1 minute 6.14 seconds (files took 14.39 seconds to load)
36 examples, 0 failures

How to set up and validate locally

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 Terri Chu

Merge request reports

Loading