Skip to content

Commit

Permalink
scheduler tests: fix for flaky vfp tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jstucke authored and maringuu committed Aug 8, 2024
1 parent f91f817 commit ee08084
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from typing import TYPE_CHECKING

import pytest
from flaky import flaky

from objects.firmware import Firmware
from test.common_helper import get_test_data_dir
Expand All @@ -28,6 +29,7 @@ def add_test_file(scheduler, path_in_test_dir):
scheduler.add_task(firmware)


@flaky(max_runs=3, min_passes=1) # test may fail when the CI is very busy
@pytest.mark.SchedulerTestConfig(items_to_unpack=4)
def test_check_collision(
frontend_db,
Expand All @@ -36,12 +38,12 @@ def test_check_collision(
unpacking_finished_event,
):
add_test_file(unpacking_scheduler, 'regression_one')
assert unpacking_finished_event.wait(timeout=20)
assert unpacking_finished_event.wait(timeout=25)
unpacking_finished_counter.value = 0
unpacking_finished_event.clear()

add_test_file(unpacking_scheduler, 'regression_two')
assert unpacking_finished_event.wait(timeout=20)
assert unpacking_finished_event.wait(timeout=25)

fo_from_db = frontend_db.get_object(TARGET_UID)
assert len(fo_from_db.virtual_file_path) == 2, 'fo should have two parents' # noqa: PLR2004
Expand All @@ -51,6 +53,7 @@ def test_check_collision(
assert fo_from_db.virtual_file_path[SECOND_ROOT_ID] == ['/test']


@flaky(max_runs=3, min_passes=1) # test may fail when the CI is very busy
@pytest.mark.SchedulerTestConfig(items_to_unpack=4)
def test_unpacking_skip(
frontend_db,
Expand All @@ -60,7 +63,7 @@ def test_unpacking_skip(
):
add_test_file(unpacking_scheduler, 'vfp_test.zip')

assert unpacking_finished_event.wait(timeout=20)
assert unpacking_finished_event.wait(timeout=25)

unpacked_objects = _collect_unpacked_files(post_unpack_queue)
assert len(list(unpacked_objects)) == INCLUDED_FILE_COUNT
Expand Down

0 comments on commit ee08084

Please sign in to comment.