-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Job that removes old SchemaContract::Validation records #16771
Conversation
Error: A file (or its parent directories) does not have a CODEOWNERS entry. Please update the .github/CODEOWNERS file and add the entry for the Offending file: app/sidekiq/schema_contract/delete_validation_records_job.rb |
Error: A file (or its parent directories) does not have a CODEOWNERS entry. Please update the .github/CODEOWNERS file and add the entry for the Offending file: app/sidekiq/schema_contract/delete_validation_records_job.rb |
Error: A file (or its parent directories) does not have a CODEOWNERS entry. Please update the .github/CODEOWNERS file and add the entry for the Offending file: app/sidekiq/schema_contract/delete_validation_records_job.rb |
Error: A file (or its parent directories) does not have a CODEOWNERS entry. Please update the .github/CODEOWNERS file and add the entry for the Offending file: app/sidekiq/schema_contract/delete_validation_records_job.rb |
Error: A file (or its parent directories) does not have a CODEOWNERS entry. Please update the .github/CODEOWNERS file and add the entry for the Offending file: spec/models/schema_contract/validation_initiator_spec.rb |
I wasn't sure who to put as the code owners. The whole |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of small suggestions about the specs, but this looks good. IDK how i got away without making the codeowners change. Maybe they tightened up the CI after I did this.
@@ -77,5 +77,21 @@ | |||
end.not_to raise_error | |||
end | |||
end | |||
|
|||
context 'when records exist that are over a month old' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest making two changes:
- I think this should go in spec/sidekiq/schema_contract/delete_validation_records_job_spec.rb. Doing this will unfortunately be another addition to the codeowners file.
- rather than check for a change in the records count, I would explicitly check after the perform to ensure that the remaining record is the one we want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I was avoiding making a new file but you're right, it should be done properly. I made the changes
Error: A file (or its parent directories) does not have a CODEOWNERS entry. Please update the .github/CODEOWNERS file and add the entry for the Offending file: spec/sidekiq/schema_contract/delete_validation_records_job_spec.rb |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for creating the new spec file.
end | ||
|
||
context 'when records exist that are over a month old' do | ||
before do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would generally recommend using let
over ivars in rspec. For a case like this, you could use let!
to achieve the same effect as a before block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, didn't know let!
would do what I wanted. I did let
and it didn't work, so TIL. Changed!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Summary
Schema contract testing creates records that have limited usefulness beyond the initial few days. This adds a job that removes old records from the database
Related issue(s)
department-of-veterans-affairs/va-mobile-app#8177
Testing done
Add test that ensures the job does the correct thing
Screenshots
Note: Optional
What areas of the site does it impact?
(Describe what parts of the site are impacted andifcode touched other areas)
Acceptance criteria
Requested Feedback
(OPTIONAL)What should the reviewers know in addition to the above. Is there anything specific you wish the reviewer to assist with. Do you have any concerns with this PR, why?