]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/dashboard: Fix test_host.py test case
authorAbhishek Desai <abhishek.desai1@ibm.com>
Mon, 25 Aug 2025 14:11:45 +0000 (19:41 +0530)
committerAbhishek Desai <abhishek.desai1@ibm.com>
Mon, 25 Aug 2025 14:11:45 +0000 (19:41 +0530)
fixes: https://tracker.ceph.com/issues/72717

Signed-off-by: Abhishek Desai <abhishek.desai1@ibm.com>
src/pybind/mgr/dashboard/tests/test_host.py

index e37b61173275b431483a4f0b64532086ef4ba569..0048e89d097cb303480aaf7b30f19acaff5b74de 100644 (file)
@@ -228,12 +228,17 @@ class HostControllerTest(ControllerTestCase):
             self.assertNotIn('service_instances', by_host['host-1'])
 
             # facts=true and include_service_instances=true
-            def get_facts_mock(hostname: str):
-                return [{
-                    'hostname': hostname,
-                    'cpu_count': 1 if hostname == 'host-0' else 2,
-                    'memory_total_kb': 1024
-                }]
+            def get_facts_mock(hostname=None, **_kwargs):
+                if hostname:
+                    return [{
+                        'hostname': hostname,
+                        'cpu_count': 1 if hostname == 'host-0' else 2,
+                        'memory_total_kb': 1024
+                    }]
+                return [
+                    {'hostname': 'host-0', 'cpu_count': 1, 'memory_total_kb': 1024},
+                    {'hostname': 'host-1', 'cpu_count': 2, 'memory_total_kb': 1024}
+                ]
 
             fake_client.hosts.get_facts.side_effect = get_facts_mock
             self._get(