Always set GITLAB_USE_MODEL_LOAD_BALANCING in test env
What does this MR do and why?
Always set GITLAB_USE_MODEL_LOAD_BALANCING in test env
Otherwise in request specs, we will create factories in one connection (main), while trying to access records in another connection (ci) while running in a controller. This is because SafeRequestStore is not active in the first situation but is active in the other.
This possibly is a problem with feature specs as well. This is only a problem when ci database is configured,
To fix this, we always set GITLAB_USE_MODEL_LOAD_BALANCING to a non-nil value so that we consistently use the same connection. We already set GITLAB_USE_MODEL_LOAD_BALANCING to true anyway in CI, so let's set that for all test environments.
This env var is not used in single database setups, so it shouldn't affect single database setups
Screenshots or screen recordings
These are strongly recommended to assist reviewers and reduce the time to merge your change.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
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.