1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-01 08:26:03 +00:00

perf(computes): a host's CPU count and memory come from its cached info

cpu_count and ram_size each called get_node_info(), which also reads the hostname, the sysinfo XML and the URI, for one value. Both now take it from host_info, the getInfo() read the proxy keeps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
This commit is contained in:
catborise 2026-11-08 12:05:19 +03:00
parent 490b7efe3f
commit a1f90ec98c
2 changed files with 9 additions and 3 deletions

View file

@ -36,6 +36,12 @@ class CapacityTests(TestCase):
self.assertIsNone(self.compute.capacity)
details.assert_not_called()
@patch("computes.models.wvmHostDetails")
def test_cpus_and_memory_come_from_the_host_info(self, details):
details.return_value.host_info = ["x86_64", 32768, 8, 2400]
self.assertEqual((self.compute.cpu_count, self.compute.ram_size), (8, 32 * GIB))
details.return_value.get_node_info.assert_not_called() # no hostname, sysinfo or URI read
class ComputesPageTests(TestCase):
def test_the_list_shows_what_each_compute_has_given(self):