@@ -1316,14 +1316,13 @@ def test_maintain_nodes(
13161316 # Run test
13171317 cluster_manager ._maintain_nodes (partitions , {})
13181318 # Check function calls
1319- active_nodes_sorted = sorted (active_nodes , key = str )
1320- mock_update_replacement .assert_called_with (active_nodes_sorted )
1319+ mock_update_replacement .assert_called_with (active_nodes )
13211320 mock_handle_dynamic .assert_called_with (expected_unhealthy_dynamic_nodes )
13221321 mock_handle_static .assert_called_with (expected_unhealthy_static_nodes )
1323- mock_handle_powering_down_nodes .assert_called_with (active_nodes_sorted )
1324- mock_handle_failed_health_check_nodes_in_replacement .assert_called_with (active_nodes_sorted )
1322+ mock_handle_powering_down_nodes .assert_called_with (active_nodes )
1323+ mock_handle_failed_health_check_nodes_in_replacement .assert_called_with (active_nodes )
13251324 if _is_protected_mode_enabled :
1326- mock_handle_protected_mode_process .assert_called_with (active_nodes_sorted , partitions )
1325+ mock_handle_protected_mode_process .assert_called_with (active_nodes , partitions )
13271326 else :
13281327 mock_handle_protected_mode_process .assert_not_called ()
13291328
@@ -3797,21 +3796,6 @@ def test_find_unhealthy_slurm_nodes(
37973796 ],
37983797)
37993798def test_find_active_nodes (partitions_name_map , expected_nodelist ):
3800- """
3801- Unit test for the `ClusterManager._find_active_nodes()` method.
3802-
3803- Some context about the way this test is implemented:
3804- - `ClusterManager._find_active_nodes()` may be implemented to return different types of iterables.
3805- This test was implemented together with a fix that changed the return type from a list to a set,
3806- and it was desirable to have the test compatible with both return types.
3807- - The implementation that returned a list caused a duplication of node entities in the returned iterable
3808- in case the same node belonged to multiple Slurm partitions (via a customization of the Slurm configuration).
3809- - Due to the way we implement the `__hash__()` dunder method for the SlurmNode class, two different
3810- SlurmNode objects with the same node name are squashed into the same entity in a set. Therefore
3811- we cannot use `set(expected_nodelist)` when trying to test the duplication of the node entities
3812- in the iterable returned by `ClusterManager._find_active_nodes()`.
3813- - Sets are unordered, so when transforming them into lists we have to sort them to make them comparable with
3814- the `expected_nodelist`.
3815- """
3816- result_nodelist = sorted (list (ClusterManager ._find_active_nodes (partitions_name_map )), key = str )
3817- assert_that (result_nodelist ).is_equal_to (sorted (expected_nodelist , key = str ))
3799+ """Unit test for the `ClusterManager._find_active_nodes()` method."""
3800+ result_nodelist = ClusterManager ._find_active_nodes (partitions_name_map )
3801+ assert_that (result_nodelist ).is_equal_to (expected_nodelist )
0 commit comments