Skip to content

Commit 442b972

Browse files
committed
test: auto tune queue size
1 parent ac81121 commit 442b972

File tree

1 file changed

+41
-2
lines changed

1 file changed

+41
-2
lines changed

tests/test_launcher.py

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,16 @@ def test_create_001():
2121
def test_create_002():
2222
with pytest.raises(ValueError):
2323
create(frontend_cls=None)
24+
with pytest.raises(ValueError):
25+
create(transport_cls=None, backend_cls=None)
2426

2527

2628
def test_create_003(config):
2729
config.queue_size = 1000
2830
config.thread_num = 10
2931
runtime_context = RuntimeContext()
30-
_ = create(frontend_engine_config=config,
31-
backend_engine_config=config,
32+
_ = create(engine_frontend_config=config,
33+
engine_backend_config=config,
3234
runtime_context=runtime_context)
3335
assert runtime_context.frontend_thread_queue.maxsize == config.queue_size
3436
assert runtime_context.frontend_thread.thread_num == config.thread_num
@@ -51,3 +53,40 @@ def test_create_005(config):
5153
_ = create(backend_cls=None, runtime_context=runtime_context)
5254
for attr in ['backend_thread', 'backend_thread_queue']:
5355
assert not hasattr(runtime_context, attr)
56+
57+
58+
def test_create_006(config):
59+
runtime_context = RuntimeContext()
60+
config.thread_num = 10
61+
_ = create(engine_frontend_config=config, runtime_context=runtime_context)
62+
assert runtime_context.frontend_thread_queue.maxsize > 10
63+
64+
65+
def test_create_007(config):
66+
runtime_context = RuntimeContext()
67+
config.queue_size = 10
68+
_ = create(engine_frontend_config=config, runtime_context=runtime_context)
69+
assert runtime_context.frontend_thread_queue.maxsize == 10
70+
71+
72+
def test_create_008(config):
73+
runtime_context = RuntimeContext()
74+
config.thread_num = 10
75+
_ = create(engine_backend_config=config, runtime_context=runtime_context)
76+
assert runtime_context.backend_thread_queue.maxsize > 10
77+
78+
79+
def test_create_009(config):
80+
runtime_context = RuntimeContext()
81+
config.thread_num = 10
82+
_ = create(transport_cls=None, engine_backend_config=config,
83+
runtime_context=runtime_context)
84+
assert runtime_context.frontend_thread_queue.maxsize > 10
85+
86+
87+
def test_create_010(config):
88+
runtime_context = RuntimeContext()
89+
config.thread_num = 10
90+
_ = create(backend_cls=None, engine_transport_config=config,
91+
runtime_context=runtime_context)
92+
assert runtime_context.frontend_thread_queue.maxsize > 10

0 commit comments

Comments
 (0)