forked from p15670423/monkey
Agent: Add leading zero to single digits in worker thread names
This commit is contained in:
parent
302718c4d4
commit
527c43a3f8
|
@ -15,7 +15,7 @@ def run_worker_threads(
|
|||
worker_threads = []
|
||||
counter = run_worker_threads.counters.setdefault(name_prefix, count(start=1))
|
||||
for i in range(0, num_workers):
|
||||
name = f"{name_prefix}-{next(counter)}"
|
||||
name = f"{name_prefix}-{next(counter):02d}"
|
||||
t = create_daemon_thread(target=target, name=name, args=args)
|
||||
t.start()
|
||||
worker_threads.append(t)
|
||||
|
|
|
@ -66,10 +66,10 @@ def test_worker_thread_names():
|
|||
run_worker_threads(target=add_thread_name_to_list, name_prefix="B", num_workers=2)
|
||||
run_worker_threads(target=add_thread_name_to_list, name_prefix="A", num_workers=2)
|
||||
|
||||
assert "A-1" in thread_names
|
||||
assert "A-2" in thread_names
|
||||
assert "A-3" in thread_names
|
||||
assert "A-4" in thread_names
|
||||
assert "B-1" in thread_names
|
||||
assert "B-2" in thread_names
|
||||
assert "A-01" in thread_names
|
||||
assert "A-02" in thread_names
|
||||
assert "A-03" in thread_names
|
||||
assert "A-04" in thread_names
|
||||
assert "B-01" in thread_names
|
||||
assert "B-02" in thread_names
|
||||
assert len(thread_names) == 6
|
||||
|
|
Loading…
Reference in New Issue