feat: release v1.1.1 - host sorting by name/IP, sync destination overrides, and ~ expansion
Build and Publish Release / Build Packages and Publish (push) Successful in 25s
Build and Publish Release / Build Packages and Publish (push) Successful in 25s
This commit is contained in:
1 parent
598e5d7397
commit
62710d8bb7
19 files changed
+190
-34
No files matched your search
@@ -113,5 +113,38 @@ class TestCliIntegration(unittest.TestCase):
|
||||
finally:
|
||||
sys.stdout = old_stdout
|
||||
|
||||
def test_cli_sort_by_ip(self):
|
||||
stdout_capture = StringIO()
|
||||
old_stdout = sys.stdout
|
||||
try:
|
||||
sys.stdout = stdout_capture
|
||||
code = main(["--check", "-q", "--sort", "ip"])
|
||||
self.assertEqual(code, 0)
|
||||
out = stdout_capture.getvalue()
|
||||
# node0 (192.168.0.101) must appear before k3s-master-0 (192.168.5.70)
|
||||
pos_node0 = out.find("node0")
|
||||
pos_k3s = out.find("k3s-master-0")
|
||||
self.assertNotEqual(pos_node0, -1)
|
||||
self.assertNotEqual(pos_k3s, -1)
|
||||
self.assertLess(pos_node0, pos_k3s)
|
||||
finally:
|
||||
sys.stdout = old_stdout
|
||||
|
||||
def test_cli_sync_destination_overrides(self):
|
||||
with TemporaryDirectory() as tmpdir:
|
||||
ansible_file = Path(tmpdir) / "custom_ansible.yaml"
|
||||
lc_file = Path(tmpdir) / "custom_lc.yaml"
|
||||
|
||||
code = main([
|
||||
"--sync", "-q",
|
||||
"--ansible-dest", str(ansible_file),
|
||||
"--lc-dest", str(lc_file)
|
||||
])
|
||||
self.assertEqual(code, 0)
|
||||
self.assertTrue(ansible_file.exists())
|
||||
self.assertTrue(lc_file.exists())
|
||||
self.assertIn("all:", ansible_file.read_text(encoding="utf-8"))
|
||||
self.assertIn("hosts:", lc_file.read_text(encoding="utf-8"))
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user