Orchestrata Ultimate › Tests › Reference › postman › test_priority

Tests reference — tests/postman/test_priority.py

Module of tests/postman, split out because the directory page would be too large.

Prose pending.

tests/postman/test_priority.py

source · 53 tests · 936 lines

Comprehensive tests for Priority Queue and Scheduler.

Covers: postman.constants, postman.exceptions, postman.priority, postman.types

Kind Name Line Description
function test_enqueue_basic 69 Test basic enqueue operation with default priority.
function test_enqueue_with_explicit_priority 79 Test enqueue with explicit priority level.
function test_enqueue_invalid_priority_too_low 89 Test enqueue rejects priority below CRITICAL (< 0).
function test_enqueue_invalid_priority_too_high 97 Test enqueue rejects priority above BACKGROUND (> 4).
function test_dequeue_empty_queue 105 Test dequeue from empty queue returns None.
function test_peek_does_not_remove 111 Test peek returns entry without removing it.
function test_peek_empty_queue 126 Test peek on empty queue returns None.
function test_clear_queue 132 Test clear removes all entries.
function test_priority_levels_order 152 Test all priority levels are ordered correctly (CRITICAL highest).
function test_fifo_within_same_priority 183 Test FIFO ordering within the same priority level.
function test_mixed_priorities_fifo 196 Test FIFO within priority when mixing different priorities.
function test_get_by_priority 221 Test retrieving entries by specific priority level.
function test_boost_priority_basic 258 Test boosting entry to higher priority.
function test_boost_priority_changes_order 273 Test boosting priority changes dequeue order.
function test_boost_priority_nonexistent_entry 291 Test boosting nonexistent entry returns False.
function test_boost_priority_same_priority 297 Test boosting to same priority returns False.
function test_boost_priority_lower_priority 306 Test boosting to lower priority (higher number) returns False.
function test_boost_priority_invalid_priority_negative 316 Test boosting to negative priority raises error.
function test_boost_priority_invalid_priority_too_high 325 Test boosting to priority > 4 from lower priority raises error or returns False.
function test_boost_to_critical 337 Test boosting to CRITICAL priority.
function test_scheduler_get_next_basic 363 Test scheduler get_next returns highest priority.
function test_scheduler_get_next_empty_queue 376 Test scheduler get_next on empty queue returns None.
function test_scheduler_priority_stats 382 Test scheduler returns accurate priority statistics.
function test_scheduler_priority_stats_empty 413 Test scheduler stats on empty queue.
function test_check_starvation_no_starvation 429 Test check_starvation when no entries are starving.
function test_check_starvation_with_aging 440 Test check_starvation detects aged entries.
function test_check_starvation_skips_critical 454 Test check_starvation skips CRITICAL priority entries.
function test_starvation_boost_single_level 468 Test starvation automatically boosts priority by one level.
function test_starvation_boost_multiple_levels 486 Test starvation boosts by multiple levels for very old entries.
function test_starvation_prevention_fairness 501 Test starvation prevention ensures fairness.
function test_starvation_multiple_entries 525 Test starvation detection with multiple aged entries.
function test_age_boost_threshold_zero 540 Test scheduler with zero age boost threshold.
function test_detect_priority_inversion_none 559 Test no priority inversion when queue is ordered correctly.
function test_detect_priority_inversion_empty_queue 572 Test priority inversion detection on empty queue.
function test_detect_priority_inversion_with_age_difference 578 Test priority inversion detected when low priority is much older.
function test_detect_priority_inversion_single_entry 604 Test priority inversion detection with single entry.
function test_checkpoint_and_recover 619 Test checkpoint persists queue state and recovery restores it.
function test_checkpoint_no_path 653 Test checkpoint without path does nothing.
function test_recover_no_checkpoint 659 Test recover without existing checkpoint returns 0.
function test_checkpoint_preserves_timestamps 665 Test checkpoint preserves entry creation timestamps.
function test_checkpoint_empty_queue 686 Test checkpointing empty queue.
function test_concurrent_enqueue 698 Test concurrent enqueue operations are thread-safe.
function test_concurrent_dequeue 712 Test concurrent dequeue operations are thread-safe.
function test_concurrent_mixed_operations 730 Test concurrent mix of enqueue/dequeue operations.
function test_large_queue 760 Test queue handles large number of entries.
function test_rapid_enqueue_dequeue 783 Test rapid enqueue/dequeue cycles.
function test_priority_boost_during_iteration 797 Test boosting priority while iterating.
function test_scheduler_with_all_critical 814 Test scheduler when all entries are CRITICAL priority.
function test_entry_id_generation 832 Test automatic entry_id generation when not provided.
function test_entry_with_existing_id 846 Test entry with pre-set entry_id is preserved.
function test_full_priority_lifecycle 860 Test complete lifecycle: enqueue, age, boost, dequeue.
function test_realistic_message_processing 884 Test realistic message processing scenario.
function test_priority_stats_after_dequeue 912 Test priority stats are accurate after dequeuing.