Skip to content

Commit

Permalink
Edit
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammadnaseri committed Sep 28, 2024
1 parent 8b53689 commit 7d1e035
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/py/flwr/server/superlink/state/state_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -716,12 +716,14 @@ def test_store_task_res_task_ins_expired(self) -> None:
10,
time.time() - 2,
6,
True,
), # TaskRes within allowed TTL
(
time.time() - 5,
10,
time.time() - 2,
15,
False,
), # TaskRes TTL exceeds max allowed TTL
]
)
Expand All @@ -731,6 +733,7 @@ def test_store_task_res_limit_ttl(
task_ins_ttl: float,
task_res_created_at: float,
task_res_ttl: float,
expected_store_result: bool,
) -> None:
"""Test the behavior of store_task_res regarding the TTL limit of TaskRes."""
# Prepare
Expand All @@ -755,14 +758,10 @@ def test_store_task_res_limit_ttl(
res = state.store_task_res(task_res)

# Assert
max_allowed_ttl = (
task_ins.task.created_at + task_ins.task.ttl - task_res.task.created_at
)

if task_res.task.ttl > max_allowed_ttl:
assert res is None
else:
if expected_store_result:
assert res is not None
else:
assert res is None


def create_task_ins(
Expand Down

0 comments on commit 7d1e035

Please sign in to comment.