You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix resource sync orphan detection to exclude system user
This change resolves failing resource sync tests by ensuring the system user
is properly excluded from orphan detection during resource synchronization.
**Problem:**
Resource sync tests were failing because the system user (_system) was being
incorrectly identified as an "orphaned" resource and deleted during sync
operations. The issue was an inconsistency between:
1. The manifest endpoint (views.py) which already excluded system users
2. The orphan detection logic (sync.py) which did not exclude system users
This caused the system user to be absent from manifests but present in
orphan detection, leading to unintended deletion.
**Solution:**
- Added system user exclusion to get_orphan_resources() function
- Used get_system_user() utility for robust system user identification
- Filter by object_id rather than username for more reliable exclusion
- Maintains consistency with existing manifest endpoint behavior
**Impact:**
- Fixes 4 failing tests: test_resource_sync, test_delete_orphans,
test_resource_sync_update_conflict, test_resource_sync_create_conflict
- Protects system user from being deleted during resource sync operations
- No impact on regular user resource synchronization behavior
Signed-off-by: Fabricio Aguiar <[email protected]>
rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED
0 commit comments