Skip to content

Commit 018aa77

Browse files
hchingsclaude
andcommitted
test(trtllm): fix fixtures for feat/rl_rc API guarantees
model_engine now exposes unwrap_compiled_model_for_refit and restore_compiled_model_after_refit, matching what the compat-drop commit makes unconditional. IPC-path assertions updated to expect recompute_active_requests (replaces reset_prefix_cache). Validated: 42/42 trtllm unit tests pass on TRT-LLM 1.3.0rc28. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 753f08e commit 018aa77

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

‎tests/unit/models/generation/trtllm/test_trtllm_backend.py‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,12 @@ def _extension(backend):
3131
model = MagicMock()
3232
model.modules.return_value = [module]
3333
model_loader = MagicMock()
34-
model_engine = SimpleNamespace(model=model, model_loader=model_loader)
34+
model_engine = SimpleNamespace(
35+
model=model,
36+
model_loader=model_loader,
37+
unwrap_compiled_model_for_refit=MagicMock(),
38+
restore_compiled_model_after_refit=MagicMock(),
39+
)
3540
engine = MagicMock()
3641
engine.model_engine = model_engine
3742
engine.control_action.side_effect = lambda **_: contextlib.nullcontext()
@@ -288,7 +293,7 @@ def test_ipc_zmq_streams_chunk_and_reloads_with_aligned_offsets(monkeypatch, fp8
288293
model_loader.begin_update_weights.assert_called_once_with()
289294
model_loader.finalize_update_weights.assert_called_once_with()
290295
model_loader.abort_update_weights.assert_not_called()
291-
engine.reset_prefix_cache.assert_called_once_with()
296+
engine.recompute_active_requests.assert_called_once_with()
292297
# COMPLETE is ACKed after the final chunk.
293298
assert extension.zmq_socket.send.call_count == 2
294299

@@ -357,7 +362,7 @@ def test_ipc_zmq_offset_mismatch_returns_false_without_reload(monkeypatch):
357362
model_loader.begin_update_weights.assert_called_once_with()
358363
model_loader.finalize_update_weights.assert_not_called()
359364
model_loader.abort_update_weights.assert_called_once_with()
360-
engine.reset_prefix_cache.assert_not_called()
365+
engine.recompute_active_requests.assert_not_called()
361366

362367

363368
def test_zmq_address_and_cleanup_are_per_gpu_and_idempotent():

‎tests/unit/models/generation/trtllm/test_trtllm_refit.py‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@ def test_collective_refit_calls_recompute_active_requests():
1717
model.modules.return_value = []
1818
model_loader = MagicMock()
1919
engine = MagicMock()
20-
engine.model_engine = SimpleNamespace(model=model, model_loader=model_loader)
20+
engine.model_engine = SimpleNamespace(
21+
model=model,
22+
model_loader=model_loader,
23+
unwrap_compiled_model_for_refit=MagicMock(),
24+
restore_compiled_model_after_refit=MagicMock(),
25+
)
2126
engine.control_action.return_value = nullcontext()
2227

2328
extension.engine = engine

0 commit comments

Comments
 (0)