Skip to content

Commit 8299a17

Browse files
committed
fix unit tests
1 parent cca1912 commit 8299a17

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

backend/onyx/connectors/confluence/connector.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,9 @@ def _fetch_page_attachments(
397397
)
398398
continue
399399

400-
logger.info(f"Processing attachment: {attachment['title']}")
400+
logger.info(
401+
f"Processing attachment: {attachment['title']} attached to page {page['title']}"
402+
)
401403

402404
# Attempt to get textual content or image summarization:
403405
object_url = build_confluence_document_id(

backend/tests/unit/onyx/connectors/confluence/test_confluence_checkpointing.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def test_load_from_checkpoint_happy_path(
148148
assert confluence_client is not None, "bad test setup"
149149
paginated_cql_mock = cast(MagicMock, confluence_client.paginated_cql_retrieval)
150150
paginated_cql_mock.side_effect = [
151-
[mock_page1, mock_page2],
151+
[mock_page1, mock_page2, mock_page3],
152152
[], # comments
153153
[], # attachments
154154
[], # comments
@@ -366,22 +366,16 @@ def test_checkpoint_progress(
366366
confluence_connector, 0, end_time
367367
)
368368

369-
assert len(outputs) == 2
369+
assert len(outputs) == 1
370370

371371
first_checkpoint = outputs[0].next_checkpoint
372-
last_checkpoint = outputs[-1].next_checkpoint
373372

374373
assert first_checkpoint == ConfluenceCheckpoint(
375374
last_updated=later_timestamp.timestamp(),
376-
has_more=True,
375+
has_more=False,
377376
last_seen_doc_ids=["1", "2"],
378377
)
379378

380-
# Verify checkpoint contains both document IDs and latest timestamp
381-
assert last_checkpoint == ConfluenceCheckpoint(
382-
last_updated=later_timestamp.timestamp(), has_more=False, last_seen_doc_ids=[]
383-
)
384-
385379
assert len(outputs[0].items) == 2
386380
assert isinstance(outputs[0].items[0], Document)
387381
assert outputs[0].items[0].semantic_identifier == "Page 1"
@@ -404,11 +398,12 @@ def test_checkpoint_progress(
404398
]
405399

406400
# Use the checkpoint from first run
401+
first_checkpoint.has_more = True
407402
outputs_with_checkpoint = load_everything_from_checkpoint_connector_from_checkpoint(
408403
confluence_connector, 0, end_time, first_checkpoint
409404
)
410405

411-
# Verify no documents were processed since they were in last_seen_doc_ids
406+
# Verify only the new page was processed since the others were in last_seen_doc_ids
412407
assert len(outputs_with_checkpoint) == 1
413408
assert len(outputs_with_checkpoint[0].items) == 1
414409
assert isinstance(outputs_with_checkpoint[0].items[0], Document)

0 commit comments

Comments
 (0)