[pve-devel] [PATCH proxmox-perl-rs 2/2] pve: test: resource scheduling: add another test where memory is secondary to CPU

Fiona Ebner f.ebner at proxmox.com
Tue Mar 21 17:44:52 CET 2023


but this time, without any start load on the node. This test fails
with librust-proxmox-resource-scheduling-dev=0.2.0-1

Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
---
 pve-rs/test/resource_scheduling.pl | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/pve-rs/test/resource_scheduling.pl b/pve-rs/test/resource_scheduling.pl
index c6724a4..e3b7d2e 100755
--- a/pve-rs/test/resource_scheduling.pl
+++ b/pve-rs/test/resource_scheduling.pl
@@ -86,16 +86,20 @@ sub test_overcommitted {
     is($nodes[3], "A", 'fourth should be A');
 }
 
-sub test_balance_small_memory_difference_with_start_load {
+sub test_balance_small_memory_difference {
+    my ($with_start_load) = @_;
+
     my $static = PVE::RS::ResourceScheduling::Static->new();
     # Memory is different to avoid flaky results with what would otherwise be ties.
     $static->add_node("A", 8, 10_000_000_000);
     $static->add_node("B", 4, 9_000_000_000);
     $static->add_node("C", 4, 8_000_000_000);
 
-    $static->add_service_usage_to_node("A", { maxcpu => 4, maxmem => 1_000_000_000 });
-    $static->add_service_usage_to_node("B", { maxcpu => 2, maxmem => 1_000_000_000 });
-    $static->add_service_usage_to_node("C", { maxcpu => 2, maxmem => 1_000_000_000 });
+    if ($with_start_load) {
+	$static->add_service_usage_to_node("A", { maxcpu => 4, maxmem => 1_000_000_000 });
+	$static->add_service_usage_to_node("B", { maxcpu => 2, maxmem => 1_000_000_000 });
+	$static->add_service_usage_to_node("C", { maxcpu => 2, maxmem => 1_000_000_000 });
+    }
 
     my $service = {
 	maxcpu => 3,
@@ -134,6 +138,7 @@ sub test_balance_small_memory_difference_with_start_load {
 test_basic();
 test_balance();
 test_overcommitted();
-test_balance_small_memory_difference_with_start_load();
+test_balance_small_memory_difference(1);
+test_balance_small_memory_difference(0);
 
 done_testing();
-- 
2.30.2






More information about the pve-devel mailing list