Fix: save_state! should only modify state field
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
toelastic_delete_by_query
trait, reduced test runtime locally from 15 minutes to 1.5 minutes. I choseelastic_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
:elastic_clean
)
before (➜ 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
:elastic_delete_by_query
)
after (❯ 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.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Terri Chu