-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
DB speedup in API::
controller/request specs
#25516
DB speedup in API::
controller/request specs
#25516
Conversation
This pull request has merge conflicts that must be resolved before it can be merged. |
b64b91a
to
98dc6d1
Compare
This pull request has resolved merge conflicts and is ready for review. |
This pull request has merge conflicts that must be resolved before it can be merged. |
98dc6d1
to
321db03
Compare
This pull request has resolved merge conflicts and is ready for review. |
This pull request has merge conflicts that must be resolved before it can be merged. |
This pull request has resolved merge conflicts and is ready for review. |
This pull request has merge conflicts that must be resolved before it can be merged. |
8d501a4
to
3f657dd
Compare
This pull request has resolved merge conflicts and is ready for review. |
This pull request has merge conflicts that must be resolved before it can be merged. |
Reduce the number of app requests being made in specs where there are multiple assertions against the same request response. When running `bin/rspec spec/controllers/api spec/requests/api`: Before changes… - ~40,100 total `sql.active_record` events - ~2,650 total `factory.create` events - Runs of ~33 seconds After changes… - ~28,650 total `sql.active_record` events - ~1,900 total `factory.create` events - Runs of ~24 seconds Total changes… - ~11,500 fewer db transactions, including ~700 fewer factories - ~10s faster run time
3f657dd
to
b840970
Compare
This pull request has resolved merge conflicts and is ready for review. |
Reduce the number of app requests being made in specs where there are multiple assertions against the same request response.
When running
bin/rspec spec/controllers/api spec/requests/api
:Before changes…
sql.active_record
eventsfactory.create
eventsAfter changes…
sql.active_record
eventsfactory.create
eventsTotal changes…
This is basically doing the same thing I did in #25486 - but for the entirety of the request and controller api specs. I think there's room to do more of this in the rest of the (non API) controller/request specs as well, but this is already a large diff and I didn't want it to get larger.
The vast majority of these are combining what was an http status check from a response into the example right under it which asserted something more meaningful. There were a few areas which could be further improved by chaining
change
blocks together, but I held off on that here.