fix: verbleibende Sysctl-Doppeldefinitionen entfernen #3
1 changed files with 8 additions and 3 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
import re
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
ROOT = Path(__file__).parents[1]
|
ROOT = Path(__file__).parents[1]
|
||||||
|
|
@ -17,6 +18,8 @@ class SysctlRoleContract(unittest.TestCase):
|
||||||
text = (ROOT / "roles/sysctl/tasks/main.yml").read_text()
|
text = (ROOT / "roles/sysctl/tasks/main.yml").read_text()
|
||||||
self.assertIn("/etc/sysctl.conf", text)
|
self.assertIn("/etc/sysctl.conf", text)
|
||||||
self.assertIn("/etc/sysctl.d/99-streaming.conf", text)
|
self.assertIn("/etc/sysctl.d/99-streaming.conf", text)
|
||||||
|
self.assertIn("/etc/sysctl.d/99-proxmox-tuning.conf", text)
|
||||||
|
self.assertIn("/etc/sysctl.d/99-zzz-cloudflare-warp-connector.conf", text)
|
||||||
self.assertIn("state: absent", text)
|
self.assertIn("state: absent", text)
|
||||||
self.assertIn("regex_escape", text)
|
self.assertIn("regex_escape", text)
|
||||||
|
|
||||||
|
|
@ -25,9 +28,11 @@ class SysctlRoleContract(unittest.TestCase):
|
||||||
self.assertLess(play.index("- sysctl\n"), play.index("- sysctl_proxmox"))
|
self.assertLess(play.index("- sysctl\n"), play.index("- sysctl_proxmox"))
|
||||||
|
|
||||||
def test_proxmox_role_does_not_duplicate_canonical_network_keys(self):
|
def test_proxmox_role_does_not_duplicate_canonical_network_keys(self):
|
||||||
text = (ROOT / "roles/sysctl_proxmox/tasks/main.yml").read_text()
|
canonical = (ROOT / "roles/sysctl/defaults/main.yml").read_text()
|
||||||
for key in ("net.core.rmem_max", "net.core.wmem_max", "net.ipv4.tcp_rmem", "net.ipv4.tcp_wmem", "net.ipv4.tcp_mtu_probing"):
|
proxmox = (ROOT / "roles/sysctl_proxmox/tasks/main.yml").read_text()
|
||||||
self.assertNotIn(key, text)
|
canonical_keys = set(re.findall(r"key:\s*([a-z0-9_.-]+)", canonical))
|
||||||
|
proxmox_keys = set(re.findall(r"key:\s*([a-z0-9_.-]+)", proxmox))
|
||||||
|
self.assertEqual(canonical_keys & proxmox_keys, set())
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue