|
1 | 1 | """Unit tests for QuotaSchedulerConfig model.""" |
2 | 2 |
|
| 3 | +from typing import Any |
| 4 | + |
3 | 5 | import pytest |
4 | 6 | from pydantic import ValidationError |
5 | 7 |
|
@@ -77,3 +79,35 @@ def test_quota_scheduler_custom_configuration_negative_reconnection_delay() -> N |
77 | 79 | QuotaSchedulerConfiguration( |
78 | 80 | database_reconnection_delay=-10 |
79 | 81 | ) # pyright: ignore[reportCallIssue] |
| 82 | + |
| 83 | + |
| 84 | +correct_configurations = [ |
| 85 | + { |
| 86 | + "period": 959, |
| 87 | + "database_reconnection_count": 125, |
| 88 | + "database_reconnection_delay": 94, |
| 89 | + }, |
| 90 | + { |
| 91 | + "period": 1, |
| 92 | + "database_reconnection_count": 125, |
| 93 | + "database_reconnection_delay": 94, |
| 94 | + }, |
| 95 | + { |
| 96 | + "period": 959, |
| 97 | + "database_reconnection_count": 1, |
| 98 | + "database_reconnection_delay": 94, |
| 99 | + }, |
| 100 | + { |
| 101 | + "period": 959, |
| 102 | + "database_reconnection_count": 125, |
| 103 | + "database_reconnection_delay": 1, |
| 104 | + }, |
| 105 | +] |
| 106 | + |
| 107 | + |
| 108 | +@pytest.mark.parametrize("config_dict", correct_configurations) |
| 109 | +def test_configure_quota_scheduler_from_dict( |
| 110 | + config_dict: dict[str, Any], |
| 111 | +) -> None: |
| 112 | + """Test the configuration initialization from dictionary with config values.""" |
| 113 | + QuotaSchedulerConfiguration(**config_dict) |
0 commit comments