test(ufw): cover the service_rules cases with fewer owners
The scenario called service_rules once per owner, eight times, about 30 tasks each, on every check, converge and idempotence pass. Three owners keep every case. - svc_a (no purge): the old svc_a (8001, 8002 with from), svc_b (8003, the 8004 deny with no comment or proto), svc_g (8022 with a comment mentioning 22), svc_e (7201 and the stale 7003 kept because purging is off). - svc_c (purge): the old svc_c (7101, stale 7001 deleted), svc_h (7301, the stale SSH lookalike kept), svc_p (7602, stale 7601 deleted, no-port, source-only and range rules kept). svc_a's stale 7003 surviving svc_c's purge proves owner isolation. - svc_d (absent): unchanged. The tagged total stays at 20 (svc_a 7, svc_c 7, svc_m 1, svc_o2 1, svc_o3 4) and the untagged at 5. Converge keeps two orphan checks, one after the three cases without a purge and one after the purge; the check after the invalid managed owner in verify goes, as the Verify play asserts the same state. Converge gathers no facts: the role reads none. Closes #457 Assisted-by: Claude Code
This commit is contained in:
1 parent
716baa19c7
commit
0779e8b5c7
4 files changed
+55
-116
No files matched your search
@@ -1,9 +1,9 @@
|
||||
---
|
||||
# Included by converge.yml and verify.yml after each orphan_rules case. The counts are
|
||||
# absolute: svc_o1 holds ufw_conv_o1_want rules (default ufw_conv_o1_initial: 2 before the
|
||||
# purge, 0 after), and the tagged total is 20 plus those. The 20: svc_a 2, svc_b 2, svc_c 1,
|
||||
# svc_e 2, svc_g 1, svc_h 2, svc_m 1, svc_o2 1, svc_o3 4 (kept orphans that may carry SSH),
|
||||
# svc_p 4 (its desired rule and three kept stale rules).
|
||||
# Included by converge.yml around the orphan_rules cases. The counts are absolute: svc_o1
|
||||
# holds ufw_conv_o1_want rules (default ufw_conv_o1_initial: 2 before the purge, 0 after),
|
||||
# and the tagged total is 20 plus those. The 20: svc_a 7 (six desired, one stale), svc_c 7
|
||||
# (three desired, four stale kept as possible SSH paths), svc_m 1, svc_o2 1, svc_o3 4 (kept
|
||||
# orphans that may carry SSH).
|
||||
- name: Read the rules ufw would load
|
||||
ansible.builtin.command: ufw show added
|
||||
register: ufw_conv_added
|
||||
@@ -18,8 +18,8 @@
|
||||
- ufw_conv_added.stdout_lines | select('search', 'svc_o2:3333333333') | list | length == 1
|
||||
- ufw_conv_added.stdout_lines | select('search', 'svc_o3:555555555[1-4]') | list | length == 4
|
||||
- ufw_conv_added.stdout_lines | select('search', 'svc_m:4444444444') | list | length == 1
|
||||
- ufw_conv_added.stdout_lines | select('search', 'svc_p:666666666[123]') | list | length == 3
|
||||
- ufw_conv_added.stdout_lines | select('search', 'svc_p:6666666664') | list | length == 0
|
||||
- ufw_conv_added.stdout_lines | select('search', 'svc_c:666666666[123]') | list | length == 3
|
||||
- ufw_conv_added.stdout_lines | select('search', 'svc_c:6666666664') | list | length == 0
|
||||
- ufw_conv_added.stdout_lines | select('match', '^ufw ') | select('search', 'ansible-ufw') | list | length == 20 + ufw_conv_o1_count | int
|
||||
- ufw_conv_added.stdout_lines | select('match', '^ufw ') | reject('search', 'ansible-ufw') | list | length == 5
|
||||
fail_msg: "Unexpected rules after the orphan_rules case: {{ ufw_conv_added.stdout_lines }}"
|
||||
|
||||
Reference in new issue
Block a user