Fix test instability in disable_segments_from_index_task tests #17455

Closed
opened 2026-02-21 19:35:37 -05:00 by yindo · 0 comments
Owner

Originally created by @laipz8200 on GitHub (Sep 15, 2025).

Originally assigned to: @laipz8200 on GitHub.

Summary

The integration tests for disable_segments_from_index_task have a potential instability issue due to order-dependent assertions when comparing segment node IDs.

Problem

The database query in disable_segments_from_index_task.py doesn't specify an ORDER BY clause when fetching segments, which means the results can be returned in any order. However, the tests were comparing the node IDs as ordered lists, which could cause intermittent test failures depending on database behavior.

Solution

Update the test assertions to compare node IDs as sets instead of lists, since the order doesn't affect the correctness of the clean() operation. This ensures the tests remain stable regardless of the order in which the database returns the segments.

Originally created by @laipz8200 on GitHub (Sep 15, 2025). Originally assigned to: @laipz8200 on GitHub. ## Summary The integration tests for `disable_segments_from_index_task` have a potential instability issue due to order-dependent assertions when comparing segment node IDs. ## Problem The database query in `disable_segments_from_index_task.py` doesn't specify an `ORDER BY` clause when fetching segments, which means the results can be returned in any order. However, the tests were comparing the node IDs as ordered lists, which could cause intermittent test failures depending on database behavior. ## Solution Update the test assertions to compare node IDs as sets instead of lists, since the order doesn't affect the correctness of the `clean()` operation. This ensures the tests remain stable regardless of the order in which the database returns the segments.
yindo closed this issue 2026-02-21 19:35:37 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#17455