Commit cd293246 authored by Achilleas Pipinellis's avatar Achilleas Pipinellis

Merge branch 'ld-add-testing-query-performance-to-testing-guide' into 'master'

Add testing query performance to testing guide

See merge request gitlab-org/gitlab!24334
parents 240e421c 2a2eceaf
...@@ -572,6 +572,27 @@ Example: ...@@ -572,6 +572,27 @@ Example:
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
``` ```
### Testing query performance
Testing query performance allows us to:
- Assert that N+1 problems do not exist within a block of code.
- Ensure that the number of queries within a block of code does not increase unnoticed.
#### QueryRecorder
`QueryRecorder` allows profiling and testing of the number of database queries
performed within a given block of code.
See the [`QueryRecorder`](../query_recorder.md) section for more details.
#### GitalyClient
`Gitlab::GitalyClient.get_request_count` allows tests of the number of Gitaly queries
made by a given block of code:
See the [`Gitaly Request Counts`](../gitaly.md#request-counts) section for more details.
### Shared contexts ### Shared contexts
Shared contexts only used in one spec file can be declared inline. Shared contexts only used in one spec file can be declared inline.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment