Reduce query work required for the feature checker during test runs.
Review Request #10618 — Created July 3, 2019 and submitted
When a particular feature is marked as experimental, the feature checker
tries to determine if the user has been granted access to the feature by
way of a setting on any Local Sites the user is a member of. This can
lead to some unstable query counts as features are introduced and change
from experimental to stable, which breaks a handful of tests.
In test runs, these checks aren't really important. We're never really
going to need to check the Local Site list for a user, since we're
working under more controlled conditions. It's also just not worth the
overhead in SQL queries.
This change updates that logic to only run if not performing a test run.
It also redoes the Local Site caching logic to be more clear and to more
consistently cache results, without redundant user authentication
Unit tests pass with experimental features registered and checked during
a test run. This was tested on
master, where this is a problem, but
the fix is going into 3.0.x.