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
TestSelfProtection.test_rule_creation_logged in spp_audit/tests/test_audit_backend.py wraps its assertions in if audit_files:. In a normal run that list is empty, so the test passes without checking anything.
The cause is that SppAuditBackendFile caches its file handle and current date on the class (_file_handle, _current_date). An earlier test (TestFileBackend) opens the day's file in its own temporary directory and then deletes that directory. Later tests that patch OPENSPP_AUDIT_FILE_PATH to a new directory still write through the stale handle, so nothing appears in the directory they inspect.
test_rule_deletion_logged in the same class should be checked for the same pattern.
Expected
The tests reset the cached handle before pointing the file backend at their own directory, and assert unconditionally that the entry was written.
Consider whether the backend itself should reopen when the configured path changes, not only when the date changes.
Notes
spp_audit/tests/test_rpc_exposure.py (PR #605) has a _reset_file_handle helper that shows the reset.
Activity