[object Object]

← back to Exo

fix placement tests

b285a9f0b77fc0e59cf6931e32cb10e2824becd2 · 2025-07-28 11:18:32 +0100 · Alex Cheema

Files touched

Diff

commit b285a9f0b77fc0e59cf6931e32cb10e2824becd2
Author: Alex Cheema <41707476+AlexCheema@users.noreply.github.com>
Date:   Mon Jul 28 11:18:32 2025 +0100

    fix placement tests
---
 master/tests/test_placement.py       | 3 +--
 master/tests/test_placement_utils.py | 6 ++++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/master/tests/test_placement.py b/master/tests/test_placement.py
index 1ab8a9ef..d12e986c 100644
--- a/master/tests/test_placement.py
+++ b/master/tests/test_placement.py
@@ -64,10 +64,9 @@ def test_get_instance_placements_create_instance(
     create_node: Callable[[int, NodeId | None], Node],
     create_connection: Callable[[NodeId, NodeId], Connection]
 ):
-    # TODO: this test is not exactly what we want. if a model can fit on one node, it should be placed there.
-    # TODO: right now we assume it will be placed across all nodes.
     # arrange
     model_meta.n_layers = total_layers
+    model_meta.storage_size_kilobytes = sum(available_memory) # make it exactly fit across all nodes
     
     create_instance_command = CreateInstanceCommand(
         command_id=CommandId(),
diff --git a/master/tests/test_placement_utils.py b/master/tests/test_placement_utils.py
index f9c286d9..d898f89a 100644
--- a/master/tests/test_placement_utils.py
+++ b/master/tests/test_placement_utils.py
@@ -37,6 +37,8 @@ def test_filter_cycles_by_memory(topology: Topology, create_node: Callable[[int,
     topology.add_connection(connection2)
     
     cycles = topology.get_cycles()
+    assert len(cycles) == 1
+    assert len(cycles[0]) == 2
 
     # act
     filtered_cycles = filter_cycles_by_memory(cycles, 1)
@@ -65,7 +67,7 @@ def test_filter_cycles_by_insufficient_memory(topology: Topology, create_node: C
     topology.add_connection(connection2)
     
     # act
-    filtered_cycles = filter_cycles_by_memory(topology.get_cycles(), 2001)
+    filtered_cycles = filter_cycles_by_memory(topology.get_cycles(), 2001*1024)
 
     # assert
     assert len(filtered_cycles) == 0
@@ -94,7 +96,7 @@ def test_filter_multiple_cycles_by_memory(topology: Topology, create_node: Calla
     cycles = topology.get_cycles()
     
     # act
-    filtered_cycles = filter_cycles_by_memory(cycles, 1500)
+    filtered_cycles = filter_cycles_by_memory(cycles, 1500*1024)
     
     # assert
     assert len(filtered_cycles) == 1

← 57ca487f Fixes for running this end to end  ·  back to Exo  ·  Add Multiaddr type and refactor Hosts type for creating shar e9b80360 →