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
4 changes: 3 additions & 1 deletion apps/agentstack-server/tasks.toml
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,12 @@ VM_NAME=e2e-test-run
{{ mise_bin }} run agentstack:delete --vm-name=${VM_NAME}
curl http://localhost:8333 >/dev/null 2>&1 && echo "Another instance at localhost:8333 is already running" && exit 2

# TODO: docling is too heavy, enable when pipeline has more resources
# --set docling.enabled=true

{{ mise_bin }} run agentstack:start \
--vm-name=${VM_NAME} \
--set externalRegistries=null \
--set docling.enabled=true \
--set ui.enabled=false \
--set auth.enabled="true" \
--set auth.basic.enabled="true" \
Expand Down
10 changes: 10 additions & 0 deletions apps/agentstack-server/tests/e2e/routes/test_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def create_fn(text: str) -> BytesIO:


@pytest.mark.usefixtures("clean_up", "setup_platform_client")
@pytest.mark.skip(reason="TODO: Docling is temporarily disabled because the image is too heavy")
async def test_text_extraction_pdf_workflow(subtests, test_configuration, test_pdf: Callable[[str], BytesIO]):
"""Test complete PDF text extraction workflow: upload -> extract -> wait -> verify"""

Expand Down Expand Up @@ -138,6 +139,15 @@ async def test_text_extraction_plain_text_workflow(subtests):
async with file.load_text_content() as loaded_text_content:
assert loaded_text_content.text == text_content

with subtests.test("delete extraction"):
await file.delete_extraction()

with (
subtests.test("verify extraction deleted"),
pytest.raises(httpx.HTTPStatusError, match="404 Not Found"),
):
_ = await file.get_extraction()
Comment on lines +142 to +149
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

It's great that you've added cleanup for the text extraction. However, the test also creates a file which is not being deleted at the end. This could lead to resource leaks in the test environment. Other tests in this file, like test_file_extraction_context_isolation, clean up both the extraction and the file. It would be best to add cleanup for the file as well to ensure resources are properly released.

Suggested change
with subtests.test("delete extraction"):
await file.delete_extraction()
with (
subtests.test("verify extraction deleted"),
pytest.raises(httpx.HTTPStatusError, match="404 Not Found"),
):
_ = await file.get_extraction()
with subtests.test("delete extraction"):
await file.delete_extraction()
with (
subtests.test("verify extraction deleted"),
pytest.raises(httpx.HTTPStatusError, match="404 Not Found"),
):
_ = await file.get_extraction()
with subtests.test("delete file"):
await file.delete()
with (
subtests.test("verify file deleted"),
pytest.raises(httpx.HTTPStatusError, match="404 Not Found"),
):
_ = await File.get(file.id)



@pytest.mark.usefixtures("clean_up", "setup_platform_client")
async def test_context_scoped_file_access(subtests):
Expand Down
Loading