Exclude empty limits when finding the user's matched rates
When a user belongs to more than one group having different
limits on different types (e.g. RESTAPI and UPLOADPACK),
the search for the first matching limit was considering the
first group ownership rather than the first group for that type.
In the example below, the search for the first matching limit
would have always returned the first group for both uploadpack
and restapi types, causing the user belonging to both groups
not being limited on restapi (2nd match) but only on uploadpack.
Example:
[group "groupLimitedOnUploadPack"]
uploadpack = 10s burst 20
[group "groupLimitedOnRestApi"]
restapi = 20s burst 40
When looking for the first matching maximum rate for a user,
do not consider the empty limits as they would hinder the ability
to find the correct configured value and keep on searching for the
first non-empty limit with a group that the current user belongs to.
Add a specific validation test on the integration test suite
for this specific quota configuration, asserting that the correct
quota is read and applied to the user.
Also make sure that the admin user in the tests, that does not belong
to any of the rate-limited groups, is not impacted and keeps on being
unlimited.
Change-Id: If82b8265b6be2d0ac8454a1a1029767b55aeff43
2 files changed