Skip to content

Commit 86a0d4e

Browse files
committed
tests are starting now
1 parent ed2755d commit 86a0d4e

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

services/director/tests/conftest.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,16 @@ def app_environment(
128128
MAX_TIME_FOR_APP_TO_SHUTDOWN = 10
129129

130130

131+
@pytest.fixture
132+
def app_settings(app_environment: EnvVarsDict) -> ApplicationSettings:
133+
return ApplicationSettings.create_from_envs()
134+
135+
131136
@pytest.fixture
132137
async def app(
133-
app_environment: EnvVarsDict, is_pdb_enabled: bool
138+
app_setting: ApplicationSettings, is_pdb_enabled: bool
134139
) -> AsyncIterator[FastAPI]:
135-
the_test_app = create_app(settings=ApplicationSettings.create_from_envs())
140+
the_test_app = create_app(settings=app_setting)
136141
async with LifespanManager(
137142
the_test_app,
138143
startup_timeout=None if is_pdb_enabled else MAX_TIME_FOR_APP_TO_STARTUP,

services/director/tests/fixtures/fake_services.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from aiodocker import utils
2020
from aiodocker.docker import Docker
2121
from aiodocker.exceptions import DockerError
22-
from simcore_service_director.config import DEFAULT_MAX_MEMORY, DEFAULT_MAX_NANO_CPUS
22+
from simcore_service_director.core.settings import ApplicationSettings
2323

2424
_logger = logging.getLogger(__name__)
2525

@@ -115,7 +115,8 @@ async def _build_and_push_image(
115115
dependent_image=None,
116116
*,
117117
bad_json_format: bool = False,
118-
) -> ServiceInRegistryInfoDict: # pylint: disable=R0913
118+
app_settings: ApplicationSettings,
119+
) -> ServiceInRegistryInfoDict:
119120

120121
# crate image
121122
service_description = _create_service_description(service_type, name, tag)
@@ -176,8 +177,8 @@ async def _build_and_push_image(
176177
# create the typical org.label-schema labels
177178
service_extras = ServiceExtrasDict(
178179
node_requirements=NodeRequirementsDict(
179-
CPU=DEFAULT_MAX_NANO_CPUS / 1e9,
180-
RAM=DEFAULT_MAX_MEMORY,
180+
CPU=app_settings.DIRECTOR_DEFAULT_MAX_NANO_CPUS / 1e9,
181+
RAM=app_settings.DIRECTOR_DEFAULT_MAX_MEMORY,
181182
),
182183
build_date="2020-08-19T15:36:27Z",
183184
vcs_ref="ca180ef1",
@@ -247,7 +248,9 @@ async def __call__(
247248

248249

249250
@pytest.fixture
250-
def push_services(docker_registry: str) -> Iterator[PushServicesCallable]:
251+
def push_services(
252+
docker_registry: str, app_settings: ApplicationSettings
253+
) -> Iterator[PushServicesCallable]:
251254
registry_url = docker_registry
252255
list_of_pushed_images_tags: list[ServiceInRegistryInfoDict] = []
253256
dependent_images = []
@@ -270,6 +273,7 @@ async def _build_push_images_to_docker_registry(
270273
tag="10.52.999999",
271274
dependent_image=None,
272275
bad_json_format=bad_json_format,
276+
app_settings=app_settings,
273277
)
274278
dependent_images.append(dependent_image)
275279

@@ -281,6 +285,7 @@ async def _build_push_images_to_docker_registry(
281285
tag=f"{version}{image_index}",
282286
dependent_image=dependent_image,
283287
bad_json_format=bad_json_format,
288+
app_settings=app_settings,
284289
)
285290
for image_index in range(number_of_computational_services)
286291
]
@@ -294,6 +299,7 @@ async def _build_push_images_to_docker_registry(
294299
tag=f"{version}{image_index}",
295300
dependent_image=dependent_image,
296301
bad_json_format=bad_json_format,
302+
app_settings=app_settings,
297303
)
298304
for image_index in range(number_of_interactive_services)
299305
]

0 commit comments

Comments
 (0)