Orchestrata Ultimate › Tests › Reference › postman › test_metrics
Tests reference — tests/postman/test_metrics.py
Module of tests/postman, split out because the directory page would be too large.
Prose pending.
tests/postman/test_metrics.py
source · 36 tests · 534 lines
Tests for PostmanMetricsCollector class.
Covers: postman.metrics, postman.types
| Kind | Name | Line | Description |
|---|---|---|---|
| class | TestPostmanMetricsCollectorInitialization |
42 | Test PostmanMetricsCollector initialization. |
| method | TestPostmanMetricsCollectorInitialization.test_init_default_parameters |
45 | Test initialization with default parameters. |
| method | TestPostmanMetricsCollectorInitialization.test_init_custom_namespace_subsystem |
60 | Test initialization with custom namespace and subsystem. |
| class | TestRecordMessageOperations |
76 | Test message recording operations. |
| method | TestRecordMessageOperations.test_record_message_sent_increments_counter |
79 | Test that record_message_sent increments the counter. |
| method | TestRecordMessageOperations.test_record_message_sent_multiple_times |
88 | Test that record_message_sent increments correctly with multiple calls. |
| method | TestRecordMessageOperations.test_record_message_sent_adds_latency_to_samples |
99 | Test that record_message_sent adds latency to samples list. |
| method | TestRecordMessageOperations.test_record_message_received_increments_counter |
110 | Test that record_message_received increments the counter. |
| method | TestRecordMessageOperations.test_record_message_received_multiple_times |
119 | Test that record_message_received increments correctly with multiple calls. |
| method | TestRecordMessageOperations.test_record_message_failed_increments_counter |
130 | Test that record_message_failed increments the counter. |
| method | TestRecordMessageOperations.test_record_message_failed_multiple_times |
139 | Test that record_message_failed increments correctly with multiple calls. |
| class | TestQueueDepthTracking |
151 | Test queue depth tracking functionality. |
| method | TestQueueDepthTracking.test_record_queue_depth_stores_depth |
154 | Test that record_queue_depth stores queue depth. |
| method | TestQueueDepthTracking.test_record_queue_depth_multiple_queues |
163 | Test that record_queue_depth handles multiple queues. |
| method | TestQueueDepthTracking.test_record_queue_depth_updates_existing_queue |
176 | Test that record_queue_depth updates existing queue depth. |
| class | TestGetSnapshot |
187 | Test get_snapshot functionality. |
| method | TestGetSnapshot.test_get_snapshot_returns_metrics_snapshot |
190 | Test that get_snapshot returns a MetricsSnapshot object. |
| method | TestGetSnapshot.test_get_snapshot_with_no_data |
198 | Test get_snapshot when no metrics have been recorded. |
| method | TestGetSnapshot.test_get_snapshot_with_message_counts |
212 | Test get_snapshot returns correct message counts. |
| method | TestGetSnapshot.test_get_snapshot_calculates_avg_latency |
227 | Test get_snapshot calculates average latency correctly. |
| method | TestGetSnapshot.test_get_snapshot_calculates_percentiles |
240 | Test get_snapshot calculates latency percentiles correctly. |
| method | TestGetSnapshot.test_get_snapshot_includes_queue_depths |
256 | Test get_snapshot includes queue depths. |
| method | TestGetSnapshot.test_get_snapshot_handles_empty_latency_samples |
268 | Test get_snapshot handles empty latency samples correctly. |
| class | TestPrometheusExport |
280 | Test Prometheus export functionality. |
| method | TestPrometheusExport.test_export_prometheus_returns_string |
283 | Test that export_prometheus returns a string. |
| method | TestPrometheusExport.test_export_prometheus_contains_metrics |
291 | Test that export_prometheus contains metric definitions. |
| method | TestPrometheusExport.test_export_prometheus_custom_namespace |
304 | Test export_prometheus with custom namespace. |
| class | TestJSONExport |
315 | Test JSON export functionality. |
| method | TestJSONExport.test_export_json_returns_dict |
318 | Test that export_json returns a dictionary. |
| method | TestJSONExport.test_export_json_contains_all_metrics |
326 | Test that export_json contains all expected metrics. |
| method | TestJSONExport.test_export_json_correct_values |
346 | Test that export_json returns correct metric values. |
| class | TestThreadSafety |
363 | Test thread safety of metrics collection. |
| method | TestThreadSafety.test_concurrent_message_sent_recording |
366 | Test concurrent recording of message_sent from multiple threads. |
| method | TestThreadSafety.test_concurrent_mixed_operations |
387 | Test concurrent mixed operations from multiple threads. |
| class | TestLatencySampleDeque |
427 | Test latency sample deque behavior. |
| method | TestLatencySampleDeque.test_latency_samples_max_length |
430 | Test that latency samples are limited to max length (1000). |
| method | TestLatencySampleDeque.test_latency_samples_keeps_recent_values |
443 | Test that latency samples keeps most recent values when over limit. |
| class | TestEdgeCases |
458 | Test edge cases and boundary conditions. |
| method | TestEdgeCases.test_zero_latency_value |
461 | Test handling of zero latency value. |
| method | TestEdgeCases.test_negative_latency_value |
470 | Test handling of negative latency value (should still record). |
| method | TestEdgeCases.test_zero_queue_depth |
484 | Test handling of zero queue depth. |
| method | TestEdgeCases.test_very_large_latency_value |
493 | Test handling of very large latency value. |
| method | TestEdgeCases.test_empty_queue_name |
502 | Test handling of empty queue name. |
| method | TestEdgeCases.test_special_characters_in_queue_name |
515 | Test handling of special characters in queue name. |
| method | TestEdgeCases.test_single_latency_sample_percentiles |
524 | Test percentile calculation with single sample. |