|
20 | 20 | from models_library.users import UserID |
21 | 21 | from pydantic import TypeAdapter |
22 | 22 | from pytest_mock import MockerFixture |
| 23 | +from pytest_simcore.helpers.monkeypatch_envs import setenvs_from_dict |
23 | 24 | from pytest_simcore.helpers.typing_env import EnvVarsDict |
24 | 25 | from servicelib.rabbitmq import RabbitMQRPCClient, RPCServerError |
25 | 26 | from servicelib.rabbitmq.rpc_interfaces.dynamic_scheduler import services |
|
29 | 30 | ) |
30 | 31 | from settings_library.rabbit import RabbitSettings |
31 | 32 | from settings_library.redis import RedisSettings |
| 33 | +from simcore_service_dynamic_scheduler.core.settings import SchedulingMode |
32 | 34 |
|
33 | 35 | pytest_simcore_core_services_selection = [ |
34 | 36 | "redis", |
@@ -133,13 +135,32 @@ def mock_director_v2_service_state( |
133 | 135 | yield None |
134 | 136 |
|
135 | 137 |
|
| 138 | +@pytest.fixture( |
| 139 | + params=[ |
| 140 | + SchedulingMode.VIA_DIRECTOR_V2, |
| 141 | + # NOTE: enable below when INTERNAL scheduler is impelmented |
| 142 | + # SchedulingMode.INTERNAL, |
| 143 | + ] |
| 144 | +) |
| 145 | +def scheduling_mode(request: pytest.FixtureRequest) -> SchedulingMode: |
| 146 | + return request.param |
| 147 | + |
| 148 | + |
136 | 149 | @pytest.fixture |
137 | 150 | def app_environment( |
| 151 | + monkeypatch: pytest.MonkeyPatch, |
138 | 152 | app_environment: EnvVarsDict, |
139 | 153 | rabbit_service: RabbitSettings, |
140 | 154 | redis_service: RedisSettings, |
| 155 | + scheduling_mode: SchedulingMode, |
141 | 156 | ) -> EnvVarsDict: |
142 | | - return app_environment |
| 157 | + return setenvs_from_dict( |
| 158 | + monkeypatch, |
| 159 | + { |
| 160 | + **app_environment, |
| 161 | + "DYNAMIC_SCHEDULER_SCHEDULING_MODE": scheduling_mode, |
| 162 | + }, |
| 163 | + ) |
143 | 164 |
|
144 | 165 |
|
145 | 166 | @pytest.fixture |
|
0 commit comments