Skip to content

Commit 3b7b4ff

Browse files
committed
renamed
1 parent 71d3b18 commit 3b7b4ff

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

services/resource-usage-tracker/tests/unit/with_dbs/test_background_task_periodic_heartbeat_check.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from collections.abc import Callable, Iterator
2-
from datetime import datetime, timedelta, timezone
2+
from datetime import UTC, datetime, timedelta
33

44
import pytest
55
import sqlalchemy as sa
@@ -21,7 +21,7 @@
2121
)
2222
from simcore_service_resource_usage_tracker.models.service_runs import ServiceRunDB
2323
from simcore_service_resource_usage_tracker.services.background_task_periodic_heartbeat_check import (
24-
periodic_check_of_running_services_task,
24+
check_running_services,
2525
)
2626

2727
pytest_simcore_core_services_selection = ["postgres", "rabbit"]
@@ -33,8 +33,8 @@
3333
_SERVICE_RUN_ID_S4L_10_MIN_OLD = "2"
3434
_SERVICE_RUN_ID_OSPARC_NOW = "3"
3535

36-
_LAST_HEARTBEAT_10_MIN_OLD = datetime.now(tz=timezone.utc) - timedelta(minutes=10)
37-
_LAST_HEARTBEAT_NOW = datetime.now(tz=timezone.utc)
36+
_LAST_HEARTBEAT_10_MIN_OLD = datetime.now(tz=UTC) - timedelta(minutes=10)
37+
_LAST_HEARTBEAT_NOW = datetime.now(tz=UTC)
3838

3939

4040
@pytest.fixture()
@@ -131,11 +131,11 @@ async def test_process_event_functions(
131131
app_settings: ApplicationSettings = initialized_app.state.settings
132132

133133
for _ in range(app_settings.RESOURCE_USAGE_TRACKER_MISSED_HEARTBEAT_COUNTER_FAIL):
134-
await periodic_check_of_running_services_task(initialized_app)
134+
await check_running_services(initialized_app)
135135
# NOTE: As we are doing check that the modified field needs to be older then some
136136
# threshold, we need to make this field artificaly older in this test
137137
with postgres_db.connect() as con:
138-
fake_old_modified_at = datetime.now(tz=timezone.utc) - timedelta(minutes=5)
138+
fake_old_modified_at = datetime.now(tz=UTC) - timedelta(minutes=5)
139139
update_stmt = resource_tracker_service_runs.update().values(
140140
modified=fake_old_modified_at
141141
)
@@ -160,7 +160,7 @@ async def test_process_event_functions(
160160
assert service_run.service_run_status == ServiceRunStatus.RUNNING
161161

162162
# Now we call the function one more time and it should consider some of running services as unhealthy
163-
await periodic_check_of_running_services_task(initialized_app)
163+
await check_running_services(initialized_app)
164164

165165
with postgres_db.connect() as con:
166166
result = con.execute(sa.select(resource_tracker_service_runs))

services/storage/tests/unit/test_dsm_cleaner.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,15 @@ def short_dsm_cleaner_interval(monkeypatch: pytest.MonkeyPatch) -> int:
3737
async def test_setup_dsm_cleaner(client: TestClient):
3838
all_tasks = asyncio.all_tasks()
3939
assert any(
40-
t.get_name().startswith(
41-
f"exclusive_periodic_task_{_TASK_NAME_PERIODICALY_CLEAN_DSM}"
42-
)
40+
t.get_name().startswith(f"{_TASK_NAME_PERIODICALY_CLEAN_DSM}")
4341
for t in all_tasks
4442
)
4543

4644

4745
async def test_disable_dsm_cleaner(disable_dsm_cleaner, client: TestClient):
4846
all_tasks = asyncio.all_tasks()
4947
assert not any(
50-
t.get_name().startswith(
51-
f"exclusive_periodic_task_{_TASK_NAME_PERIODICALY_CLEAN_DSM}"
52-
)
48+
t.get_name().startswith(f"{_TASK_NAME_PERIODICALY_CLEAN_DSM}")
5349
for t in all_tasks
5450
)
5551

0 commit comments

Comments
 (0)