[PR #25737] fix(tests): resolve order dependency in disable_segments_from_index_task tests #31184

Closed
opened 2026-02-21 20:48:59 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/25737

State: closed
Merged: Yes


Summary

This PR fixes a test instability issue in the disable_segments_from_index_task integration tests by removing order dependency from assertions.

Changes

  • Updated test assertions to compare segment node IDs as sets instead of ordered lists
  • Affected tests:
    • test_disable_segments_success
    • test_disable_segments_mixed_valid_invalid_ids

Why This Fix Is Needed

The database query in disable_segments_from_index_task.py doesn't specify an ORDER BY clause when fetching segments, meaning results can be returned in any order depending on database internals. The tests were comparing node IDs as ordered lists, which could cause intermittent failures. Since the order doesn't affect the correctness of the clean() operation, comparing as sets ensures stable test results.

Fixes #25736

**Original Pull Request:** https://github.com/langgenius/dify/pull/25737 **State:** closed **Merged:** Yes --- ## Summary This PR fixes a test instability issue in the `disable_segments_from_index_task` integration tests by removing order dependency from assertions. ## Changes - Updated test assertions to compare segment node IDs as sets instead of ordered lists - Affected tests: - `test_disable_segments_success` - `test_disable_segments_mixed_valid_invalid_ids` ## Why This Fix Is Needed The database query in `disable_segments_from_index_task.py` doesn't specify an `ORDER BY` clause when fetching segments, meaning results can be returned in any order depending on database internals. The tests were comparing node IDs as ordered lists, which could cause intermittent failures. Since the order doesn't affect the correctness of the `clean()` operation, comparing as sets ensures stable test results. Fixes #25736
yindo added the pull-request label 2026-02-21 20:48:59 -05:00
yindo closed this issue 2026-02-21 20:48:59 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#31184