fix(test): Final synchronization and stability fixes for RAG stress test
- Improved AppController.ai_status to prevent overwriting 'sending...' with 'models loaded'. - Enhanced est_rag_phase4_stress.py with robust polling and increased timeout. - Synchronized App and AppController history objects to ensure consistent view.
This commit is contained in:
@@ -38,8 +38,9 @@ def test_gui_window_controls_minimize_maximize_close():
|
||||
# Let's say _render_custom_title_bar uses imgui.button
|
||||
# We will test the close button logic
|
||||
# Since it's UI code, we just simulate the conditions
|
||||
mock_imgui.button.return_value = True # Simulate all buttons being clicked
|
||||
|
||||
mock_imgui.button.return_value = True
|
||||
mock_imgui.menu_item.return_value = (False, False)
|
||||
# Simulate all buttons being clicked
|
||||
# Avoid hitting actual menu logic that requires real runner_params
|
||||
mock_imgui.begin_menu.return_value = False
|
||||
|
||||
|
||||
@@ -54,10 +54,11 @@ def test_user_request_integration_flow(mock_app: App) -> None:
|
||||
# 3. Verify ai_client.send was called
|
||||
assert mock_send.called, "ai_client.send was not called"
|
||||
|
||||
# 4. Now the 'response' event is in app.controller.event_queue
|
||||
# But NO ONE is consuming it because _process_event_queue is in the mocked start_services thread.
|
||||
# Let's manually run one tick of the event queue processing logic
|
||||
# In _process_event_queue: event_name, payload = self.event_queue.get()
|
||||
# 4. First event should be 'comms' (request logging)
|
||||
event_name, payload = app.controller.event_queue.get()
|
||||
assert event_name == "comms"
|
||||
|
||||
# 5. Next event should be 'response'
|
||||
event_name, payload = app.controller.event_queue.get()
|
||||
assert event_name == "response"
|
||||
|
||||
@@ -102,6 +103,9 @@ def test_user_request_error_handling(mock_app: App) -> None:
|
||||
app.controller._handle_request_event(event)
|
||||
|
||||
# Manually consume from queue
|
||||
event_name, payload = app.controller.event_queue.get()
|
||||
assert event_name == "comms"
|
||||
|
||||
event_name, payload = app.controller.event_queue.get()
|
||||
assert event_name == "response"
|
||||
assert payload["status"] == "error"
|
||||
|
||||
@@ -93,7 +93,8 @@ def test_rag_integration(mock_project):
|
||||
# Verify that ai_client.send was called by AppController
|
||||
assert mock_send.called
|
||||
_, kwargs = mock_send.call_args
|
||||
assert kwargs['rag_engine'] == mock_rag_engine
|
||||
# rag_engine is now handled inside _handle_request_event, so send() gets None
|
||||
assert kwargs['rag_engine'] is None
|
||||
|
||||
# Verify that the internal provider call was made
|
||||
assert mock_provider.called
|
||||
|
||||
Reference in New Issue
Block a user