Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES/+fix_pytest_long_running.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Fixed the `long_running` pytest-mark, so that it correctly applies even when "nightly"
is selected. This includes fixing a window in the task-cleanup path, where a missing
worker's jobs were not getting cleaned up until a new task entered the system.
15 changes: 7 additions & 8 deletions pulpcore/pytest_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,7 @@ def pytest_addoption(parser):
)

def pytest_collection_modifyitems(config, items):
# Skip nightly tests by default
# https://docs.pytest.org/en/7.1.x/example/simple.html#control-skipping-of-tests-according-to-command-line-option
if config.getoption("--nightly"):
# Run all tests unmodified
return
skip_nightly = pytest.mark.skip(reason="need --nightly option to run")
for item in items:
if "nightly" in item.keywords:
item.add_marker(skip_nightly)

# Skip long_running tests if --timeout is below 600
timeout = config.getoption("--timeout", default=None)
Expand All @@ -61,6 +53,13 @@ def pytest_collection_modifyitems(config, items):
if "long_running" in item.keywords:
item.add_marker(skip_long)

# Skip anything labeled "nightly" unless --nightly specified
if not config.getoption("--nightly"):
skip_nightly = pytest.mark.skip(reason="need --nightly option to run")
for item in items:
if "nightly" in item.keywords:
item.add_marker(skip_nightly)

Comment thread
ggainey marked this conversation as resolved.

class PulpTaskTimeoutError(Exception):
"""Exception to describe task and taskgroup timeout errors."""
Expand Down
4 changes: 1 addition & 3 deletions pulpcore/tasking/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,7 @@ def unblock_tasks(self):
self.wakeup_unblock = False
result = self._unblock_tasks()
if result is not None and (
Task.objects.filter(
state__in=[TASK_STATES.WAITING, TASK_STATES.CANCELING], app_lock=None
)
Task.objects.filter(state__in=TASK_INCOMPLETE_STATES, app_lock=None)
.exclude(unblocked_at=None)
.exists()
):
Expand Down
Loading