mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-05-01 07:13:00 +00:00
fix: resolve race condition in guardrail event emission test
This commit is contained in:
@@ -249,6 +249,8 @@ def test_guardrail_emits_events(sample_agent):
|
|||||||
|
|
||||||
result = task.execute_sync(agent=sample_agent)
|
result = task.execute_sync(agent=sample_agent)
|
||||||
|
|
||||||
|
crewai_event_bus.flush(timeout=10.0)
|
||||||
|
|
||||||
with condition:
|
with condition:
|
||||||
success = condition.wait_for(
|
success = condition.wait_for(
|
||||||
lambda: len(started_guardrail) >= 2 and len(completed_guardrail) >= 2,
|
lambda: len(started_guardrail) >= 2 and len(completed_guardrail) >= 2,
|
||||||
@@ -267,6 +269,8 @@ def test_guardrail_emits_events(sample_agent):
|
|||||||
|
|
||||||
task.execute_sync(agent=sample_agent)
|
task.execute_sync(agent=sample_agent)
|
||||||
|
|
||||||
|
crewai_event_bus.flush(timeout=10.0)
|
||||||
|
|
||||||
with condition:
|
with condition:
|
||||||
success = condition.wait_for(
|
success = condition.wait_for(
|
||||||
lambda: len(started_guardrail) >= 3 and len(completed_guardrail) >= 3,
|
lambda: len(started_guardrail) >= 3 and len(completed_guardrail) >= 3,
|
||||||
|
|||||||
Reference in New Issue
Block a user