Skip to content

Commit 97514a4

Browse files
dguidoclaude
andcommitted
fix: Correct privacy template test - use privacy-logrotate.j2 not 99-privacy-enhanced.j2
## Issue Resolution ### Template Name Confusion Fixed - **Problem**: Test expected `99-privacy-enhanced.j2` template (which shouldn't exist) - **Reality**: Task uses `privacy-logrotate.j2` template to create `/etc/logrotate.d/99-privacy-enhanced` file - **Solution**: Updated test to use correct template name `privacy-logrotate.j2` ### Implementation Details - **✅ Correct Flow**: `privacy-logrotate.j2` → `/etc/logrotate.d/99-privacy-enhanced` - **❌ Wrong Expectation**: Looking for `99-privacy-enhanced.j2` template file - **✅ Fixed**: Test now validates the actual template that creates the logrotate config ### Enhanced Test Coverage - **Added privacy-logrotate.j2** to active template tests - **Updated test variables** with missing logrotate parameters: - `rotate_count: 3` - `daily_rotation: True` - **Added proper validation** for logrotate template content: - Rotation count configuration - Max age settings - Syslog rotation rules ### Why This Matters The original question "Why is this intentionally unimplemented?" was correct - there was no good reason for the template to be missing. The actual issue was: 1. **The template exists** (`privacy-logrotate.j2`) 2. **The test was wrong** (looking for non-existent `99-privacy-enhanced.j2`) 3. **The functionality works** (creates `/etc/logrotate.d/99-privacy-enhanced` correctly) ## Test Results - ✅ **4/4 privacy tests passing** - ✅ **Complete template coverage** for all implemented privacy templates - ✅ **Proper logrotate validation** with realistic test parameters This resolves the template gap feedback completely - all privacy templates that should exist are now properly tested. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 489cd7e commit 97514a4

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

tests/unit/test_privacy_role.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ def get_privacy_test_variables():
2727
'privacy_log_rotation': {
2828
'max_age': 7,
2929
'max_size': 50,
30-
'compress': True
30+
'compress': True,
31+
'rotate_count': 3,
32+
'daily_rotation': True
3133
},
3234
'privacy_log_filtering': {
3335
'exclude_vpn_logs': True,
@@ -111,9 +113,8 @@ def test_privacy_template_rendering():
111113
privacy_templates = [
112114
'roles/privacy/templates/49-privacy-vpn-filter.conf.j2',
113115
'roles/privacy/templates/privacy-monitor.sh.j2',
114-
'roles/privacy/templates/privacy-auto-cleanup.sh.j2', # Now implemented
115-
# Skip templates that don't exist yet
116-
# 'roles/privacy/templates/99-privacy-enhanced.j2',
116+
'roles/privacy/templates/privacy-auto-cleanup.sh.j2',
117+
'roles/privacy/templates/privacy-logrotate.j2', # Creates /etc/logrotate.d/99-privacy-enhanced
117118
]
118119

119120
test_vars = get_privacy_test_variables()
@@ -157,9 +158,11 @@ def test_privacy_template_rendering():
157158
if test_vars['privacy_auto_cleanup']['enabled']:
158159
assert 'Starting privacy cleanup' in output, "Missing cleanup start message"
159160

160-
elif '99-privacy-enhanced.j2' in template_name:
161-
# Should contain logrotate configuration
162-
assert 'daily' in output or 'weekly' in output, "Missing rotation frequency"
161+
elif 'privacy-logrotate.j2' in template_name:
162+
# Should contain logrotate configuration
163+
assert 'rotate' in output, "Missing rotation count"
164+
assert 'maxage' in output, "Missing max age configuration"
165+
assert '/var/log/syslog' in output, "Missing syslog rotation"
163166

164167
except UndefinedError as e:
165168
errors.append(f"{template_path}: Missing variable - {e}")

0 commit comments

Comments
 (0)