Missing tests for lock file functionality #19

Open
opened 2025-11-15 03:44:20 +00:00 by snegov · 0 comments
Owner

Missing tests for lock file functionality

Priority: High
Component: tests/test_backups.py
Type: Testing

Description

The lock file mechanism (set_backups_lock, release_backups_lock) has no unit tests, despite being critical for preventing concurrent backups.

Missing Test Coverage

  • Lock creation and acquisition
  • Lock detection when another process is running
  • Stale lock detection (process no longer exists)
  • Force flag behavior
  • Lock release
  • Corrupted lock file handling
  • Race conditions

Proposed Tests

def test_lock_creation(self):
    """Test lock file is created with current PID"""

def test_lock_prevents_concurrent_backup(self):
    """Test second backup is blocked when lock exists"""

def test_stale_lock_is_removed(self):
    """Test lock from dead process is cleaned up"""

def test_force_flag_overrides_lock(self):
    """Test force flag allows backup despite lock"""

def test_corrupted_lock_is_handled(self):
    """Test backup continues if lock file is corrupted"""

Impact

High - Critical functionality is untested.

# Missing tests for lock file functionality **Priority:** High **Component:** tests/test_backups.py **Type:** Testing ## Description The lock file mechanism (`set_backups_lock`, `release_backups_lock`) has no unit tests, despite being critical for preventing concurrent backups. ## Missing Test Coverage - Lock creation and acquisition - Lock detection when another process is running - Stale lock detection (process no longer exists) - Force flag behavior - Lock release - Corrupted lock file handling - Race conditions ## Proposed Tests ```python def test_lock_creation(self): """Test lock file is created with current PID""" def test_lock_prevents_concurrent_backup(self): """Test second backup is blocked when lock exists""" def test_stale_lock_is_removed(self): """Test lock from dead process is cleaned up""" def test_force_flag_overrides_lock(self): """Test force flag allows backup despite lock""" def test_corrupted_lock_is_handled(self): """Test backup continues if lock file is corrupted""" ``` ## Impact **High** - Critical functionality is untested.
Sign in to join this conversation.
No Label
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: snegov/cura-te-ipsum#19
No description provided.