From: afreen23 Date: Tue, 26 Aug 2025 15:18:59 +0000 (+0530) Subject: Merge pull request #65224 from rhcs-dashboard/wip-72711-tentacle X-Git-Tag: testing/wip-jcollin-testing-20250827.105003-tentacle~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8c3bfa64667075134983e20913c781052e1a930a;p=ceph-ci.git Merge pull request #65224 from rhcs-dashboard/wip-72711-tentacle tentacle: mgr/dashboard : Optimized /host API to minimum resp Reviewed-by: Afreen Misbah --- 8c3bfa64667075134983e20913c781052e1a930a diff --cc src/pybind/mgr/dashboard/tests/test_host.py index 10a6c9508f6,aebfa0e31f6..0048e89d097 --- a/src/pybind/mgr/dashboard/tests/test_host.py +++ b/src/pybind/mgr/dashboard/tests/test_host.py @@@ -105,33 -105,50 +105,51 @@@ class HostControllerTest(ControllerTest 'ceph': True, 'orchestrator': False }, + 'addr': '', + 'cpu_cores': 0, + 'model': '', + 'nic_count': 0, + 'hdd_count': 0, + 'flash_count': 0, + 'hdd_capacity_bytes': 0, + 'flash_capacity_bytes': 0, 'cpu_count': 1, 'memory_total_kb': 1024, - 'services': [], - 'service_instances': [{'type': 'mon', 'count': 1}] + 'services': [] }, { 'hostname': 'host-1', 'sources': { 'ceph': False, 'orchestrator': True }, + 'addr': '', + 'cpu_cores': 0, + 'model': '', + 'nic_count': 0, + 'hdd_count': 0, + 'flash_count': 0, + 'hdd_capacity_bytes': 0, + 'flash_capacity_bytes': 0, 'cpu_count': 2, 'memory_total_kb': 1024, - 'services': [], - 'service_instances': [{'type': 'mon', 'count': 1}] + 'services': [] }] # test with orchestrator available with patch_orch(True, hosts=hosts_without_facts) as fake_client: mock_get_hosts.return_value = hosts_without_facts - def get_facts_mock(hostname: str): - if hostname == 'host-0': - return [hosts_facts[0]] - return [hosts_facts[1]] + def get_facts_mock(*args, **_kwargs): + if args: + hostname = args[0] + return [hosts_facts[0]] if hostname == 'host-0' else [hosts_facts[1]] + return hosts_facts + fake_client.hosts.get_facts.side_effect = get_facts_mock - # test with ?facts=true - self._get('{}?facts=true'.format(self.URL_HOST), version=APIVersion(1, 3)) + # test with ?facts=true (explicitly disable service_instances) + self._get( + '{}?facts=true&include_service_instances=false'.format(self.URL_HOST), + version=APIVersion(1, 3) + ) self.assertStatus(200) self.assertHeader('Content-Type', APIVersion(1, 3).to_mime_type())