Document test findings and fix mount script

Test Results (74 tests):
- 12 passed, 56 failures, 3 errors, 3 skipped

Bugs Detected:
1. Nested methods bug: lines 758-1144 indented inside access()
   - FUSE operations (readdir, open, read, write) unreachable
   - os.listdir() returns ENOSYS (Function not implemented)

2. Directory tree building: KeyError in FSNode.getnode()
   - Mount fails when library contains tracks

3. Unmount not clean: filesystem not releasing properly

Changes:
- Fix conftest.py: inline sanitization (no module-level sanitize fn)
- Add test findings to e2e-test-plan.md
- Add .gitignore for .pyc and test artifacts
This commit is contained in:
Alexander
2026-05-12 14:29:05 +02:00
parent 81df4790bf
commit f8666ae8c6
3 changed files with 142 additions and 31 deletions
+79
View File
@@ -2,6 +2,36 @@
> **Reviewed by Oracle** - Critical bug discovered, plan updated accordingly
## Test Results (Latest Run)
```
Tests run: 74
Passed: 12
Failures: 56
Errors: 3
Skipped: 3
Duration: ~103 seconds
```
### Bugs Detected by Tests
| Bug | Tests Affected | Description |
|-----|----------------|-------------|
| **Nested Methods** | 56 | Lines 758-1144 indented inside `access()` - FUSE operations unreachable |
| **Directory Tree Building** | 3 | `KeyError` in `FSNode.getnode()` when adding files |
| **Unmount** | 1 | Filesystem not unmounting cleanly |
### Passing Tests (12)
- `test_fuse_available` - FUSE/fusermount detected
- `test_library_fixture_created` - SQLite DB and music dir created
- `test_temp_directory_created` - Temp dirs set up correctly
- `test_mount_empty_library` - **Mount works with empty library!**
- `test_list_empty_root` - Empty root returns empty list
- `test_list_root_returns_list` - Returns list type
- `test_access_empty_path` - Handles empty path
- Plus 5 nested bug detection tests (confirming bug exists)
## Executive Summary
E2E tests for beetfs FUSE filesystem using real music files from qBittorrent container. No mocks - actual filesystem operations against mounted beetfs.
@@ -405,6 +435,55 @@ pkgs.flac # For FLAC encoding
---
## Findings from Test Execution
### Bug #1: Nested Methods (CRITICAL)
**Location**: `beetFs.py` lines 758-1144
**Problem**: All FUSE operation methods are indented inside the `access()` method, making them local functions instead of class methods.
**Evidence**:
```python
def access(self, path, flags): # Line 723 - correct class method
...
return 0
def readdir(self, path, ...): # Line 931 - WRONG! Nested inside access()
...
def open(self, path, flags): # Line 988 - Also nested
...
def read(self, path, ...): # Line 1077 - Also nested
...
```
**Symptom**: `os.listdir()` returns `OSError: [Errno 38] Function not implemented`
**Fix Required**: Dedent lines 758-1144 by 8 spaces to make them class methods.
### Bug #2: Directory Tree Building
**Location**: `beetFs.py` lines 403-414 (`FSNode.getnode()` and `FSNode.adddir()`)
**Problem**: When adding files to the directory structure, the code assumes parent directories already exist.
**Evidence**:
```
KeyError: u'Test Artist'
File "beetFs.py", line 403, in getnode
return self.getnode(elements, root=root.dirs[topdir])
```
**Symptom**: Mount fails when library contains tracks.
### Bug #3: Unmount Not Clean
**Problem**: After unmounting, `os.path.ismount()` still returns `True`.
**Likely Cause**: FUSE process not terminating properly, or lazy unmount not completing.
---
## Notes from Oracle Review
1. **MP3 is not "readonly"** - metadata overlay is disabled (`bound=0`), but reads still work