Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove specific users #2962

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Reduce scope of the test
paulcFanDuel committed Oct 30, 2024
commit 1f075ef5b1aac6a474f1d6c38323caf6c470e2b5
22 changes: 0 additions & 22 deletions locust/test/test_dispatch.py
Original file line number Diff line number Diff line change
@@ -4196,43 +4196,21 @@ class User3(User):
users_dispatcher._wait_between_dispatch = sleep_time

# Add equal spread of Users 1, 2, 3
ts = time.perf_counter()
self.assertDictEqual(
next(users_dispatcher),
{
"1": {"User1": 3, "User2": 3, "User3": 3},
},
)
delta = time.perf_counter() - ts
self.assertTrue(0 <= delta <= _TOLERANCE, delta)

# Now remove All instances of User2
users_dispatcher.new_dispatch(target_user_count=6, spawn_rate=3, user_classes=[User2])

ts = time.perf_counter()
self.assertDictEqual(
next(users_dispatcher),
{
"1": {"User1": 3, "User2": 0, "User3": 3},
},
)
delta = time.perf_counter() - ts
self.assertTrue(0 <= delta <= _TOLERANCE, delta)

# Now remove only 1 instance of User3
users_dispatcher.new_dispatch(target_user_count=5, spawn_rate=1, user_classes=[User3])

ts = time.perf_counter()
self.assertDictEqual(
next(users_dispatcher),
{
"1": {"User1": 3, "User2": 0, "User3": 2},
},
)
delta = time.perf_counter() - ts
self.assertTrue(0 <= delta <= _TOLERANCE, delta)

ts = time.perf_counter()
self.assertRaises(StopIteration, lambda: next(users_dispatcher))
delta = time.perf_counter() - ts
self.assertTrue(0 <= delta <= _TOLERANCE, delta)