From 2db1b5c9a218e44da5d5d769bb72f81a8e6f42c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janier=20Rodr=C3=ADguez?= Date: Thu, 20 Aug 2026 02:07:03 +0200 Subject: [PATCH] fix(tests): do not depend on DNS in physical machines migration test The multiple IPs fixture included a 'localhost' entry that the test expected to be dropped because it does not resolve, and asserted a hostname obtained from a reverse lookup of 172.27.1.25-27. Both hold only on a machine whose resolver behaves like ours, so the test failed elsewhere. Same fix already applied on master. --- .../services/physical_machines/test_migration.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/server/tests/services/physical_machines/test_migration.py b/server/tests/services/physical_machines/test_migration.py index b8bd3b134..d5649f5f6 100644 --- a/server/tests/services/physical_machines/test_migration.py +++ b/server/tests/services/physical_machines/test_migration.py @@ -215,7 +215,7 @@ { 'owner': 't-service-144', 'key': '848d16fb421048c690c9761c11dc1699', - 'data': 'gASVUwAAAAAAAABdlCiMHzE3Mi4yNy4xLjI1OzAxOjIzOjQ1OjY3Ojg5OkFCfjGUjA0xNzIuMjcuMS4yNn4xlIwNMTcyLjI3LjEuMjd+MpSMCWxvY2FsaG9zdJRlLg==', + 'data': 'gASVRwAAAAAAAABdlCiMHzE3Mi4yNy4xLjI1OzAxOjIzOjQ1OjY3Ojg5OkFCfjGUjA0xNzIuMjcuMS4yNn4xlIwNMTcyLjI3LjEuMjd+MpRlLg==', 'attr1': '', }, {'owner': 't-service-142', 'key': 'b6ac33477ae0a82fa2681c4d398d88d7', 'data': 'gARLAS4=\n', 'attr1': ''}, @@ -282,11 +282,12 @@ def test_migrate(self) -> None: # - 172.27.1.25 # - 172.27.1.26 # - 172.27.1.27 - # - localhost;01:23:45:67:89:AB # - One service pool # - Two user services # * First one, is localhost # * Second one is 172.27.1.26 + # Note: On GitHub automated tests, localhost CAN be resolved, so i have removed it from the list of ips to add + # So test is valid for both cases # First, proceed to migration of data physical_machine_multiple.migrate(self.apps_mock(), None) @@ -319,11 +320,14 @@ def test_migrate(self) -> None: ) self.assertIn(server.ip, ips_to_check, f'Invalid server ip {server.ip}: {ips_to_check}') ips_to_check.remove(server.ip) + + # Note: to this to work, reverse dns for + # 172.27.1.25-27 must be configured on the system where tests are run + # If not, the test will fail # Ensure has a hostname, and MAC is empty - self.assertNotEqual(server.hostname, '') + # self.assertNotEqual(server.hostname, '') # 172.27.1.25 has a MAC, rest of servers have MAC_UNKNOWN (empty equivalent) - # Also, should have 127.0.0.1 as ip if localhost if server.ip == '172.27.1.25': self.assertEqual(server.mac, '01:23:45:67:89:AB') else: