[Core] Make iterations numeration starting from `1'
As discussed on daily meeting, iterations numbers in logging and reports must be synchronized and starting from `1' Change-Id: I5967c51b033e1a98f2617c5aa8f8e7916de90a08
This commit is contained in:
parent
949b0ebca8
commit
a082416462
@ -87,12 +87,15 @@ class UserContextMixin(object):
|
||||
else:
|
||||
# Second and last case - 'round_robin'.
|
||||
tenants_amount = len(context_obj["tenants"])
|
||||
tenant_id = sorted(context_obj["tenants"].keys())[
|
||||
context_obj["iteration"] % tenants_amount]
|
||||
# NOTE(amaretskiy): iteration is subtracted by `1' because it
|
||||
# starts from `1' but we count from `0'
|
||||
tenant_index = int((context_obj["iteration"] - 1) % tenants_amount)
|
||||
tenant_id = sorted(context_obj["tenants"].keys())[tenant_index]
|
||||
tenant = context_obj["tenants"][tenant_id]
|
||||
users = context_obj["tenants"][tenant_id]["users"]
|
||||
user = users[
|
||||
int(context_obj["iteration"] / tenants_amount) % len(users)]
|
||||
user_index = int(((context_obj["iteration"] - 1) / tenants_amount)
|
||||
% len(users))
|
||||
user = users[user_index]
|
||||
|
||||
scenario_ctx["user"], scenario_ctx["tenant"] = user, tenant
|
||||
|
||||
|
@ -120,7 +120,7 @@ class UserContextMixinTestCase(test.TestCase):
|
||||
}
|
||||
expected_ids = ["0_0", "1_0", "0_1", "1_1"] * 4
|
||||
mapped_ids = []
|
||||
for i in range(16):
|
||||
for i in range(1, 17):
|
||||
context["iteration"] = i
|
||||
user = self.mixin.map_for_scenario(context)
|
||||
mapped_ids.append(user["user"]["id"])
|
||||
|
Loading…
x
Reference in New Issue
Block a user