Skip to content

Commit 9c428bf

Browse files
author
Abhishek Desai
committed
mgr/dashboard: Fix test_host.py test case
fixes: https://tracker.ceph.com/issues/72717 Signed-off-by: Abhishek Desai <[email protected]>
1 parent f4d8694 commit 9c428bf

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/pybind/mgr/dashboard/tests/test_host.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -228,12 +228,17 @@ def list_daemons_mock(hostname=None, **_kwargs):
228228
self.assertNotIn('service_instances', by_host['host-1'])
229229

230230
# facts=true and include_service_instances=true
231-
def get_facts_mock(hostname: str):
232-
return [{
233-
'hostname': hostname,
234-
'cpu_count': 1 if hostname == 'host-0' else 2,
235-
'memory_total_kb': 1024
236-
}]
231+
def get_facts_mock(hostname=None, **_kwargs):
232+
if hostname:
233+
return [{
234+
'hostname': hostname,
235+
'cpu_count': 1 if hostname == 'host-0' else 2,
236+
'memory_total_kb': 1024
237+
}]
238+
return [
239+
{'hostname': 'host-0', 'cpu_count': 1, 'memory_total_kb': 1024},
240+
{'hostname': 'host-1', 'cpu_count': 2, 'memory_total_kb': 1024}
241+
]
237242

238243
fake_client.hosts.get_facts.side_effect = get_facts_mock
239244
self._get(

0 commit comments

Comments
 (0)