From 6f8a6c8ddf03d7aa4d9287d6b499a195e099d603 Mon Sep 17 00:00:00 2001 From: arin-mirza Date: Fri, 21 Nov 2025 14:01:50 +0100 Subject: [PATCH] Add SQL test cases for the new mem_pool functionality for resource groups --- echo | 0 .../test_create_resource_group_with_mem_pool | 18 +++++++ ...esource_group_with_mem_pool_then_try_alter | 46 +++++++++++++++++ ...t_create_two_resource_groups_with_mem_pool | 35 +++++++++++++ ...e_groups_with_mem_pool_different_mem_limit | 37 ++++++++++++++ ...source_groups_with_mem_pool_then_try_alter | 50 +++++++++++++++++++ .../test_create_resource_group_with_mem_pool | 15 ++++++ ...esource_group_with_mem_pool_then_try_alter | 31 ++++++++++++ ...t_create_two_resource_groups_with_mem_pool | 27 ++++++++++ ...e_groups_with_mem_pool_different_mem_limit | 26 ++++++++++ ...source_groups_with_mem_pool_then_try_alter | 38 ++++++++++++++ 11 files changed, 323 insertions(+) create mode 100644 echo create mode 100644 test/sql/test_resource_group_mem_pool/R/test_create_resource_group_with_mem_pool create mode 100644 test/sql/test_resource_group_mem_pool/R/test_create_resource_group_with_mem_pool_then_try_alter create mode 100644 test/sql/test_resource_group_mem_pool/R/test_create_two_resource_groups_with_mem_pool create mode 100644 test/sql/test_resource_group_mem_pool/R/test_create_two_resource_groups_with_mem_pool_different_mem_limit create mode 100644 test/sql/test_resource_group_mem_pool/R/test_create_two_resource_groups_with_mem_pool_then_try_alter create mode 100644 test/sql/test_resource_group_mem_pool/T/test_create_resource_group_with_mem_pool create mode 100644 test/sql/test_resource_group_mem_pool/T/test_create_resource_group_with_mem_pool_then_try_alter create mode 100644 test/sql/test_resource_group_mem_pool/T/test_create_two_resource_groups_with_mem_pool create mode 100644 test/sql/test_resource_group_mem_pool/T/test_create_two_resource_groups_with_mem_pool_different_mem_limit create mode 100644 test/sql/test_resource_group_mem_pool/T/test_create_two_resource_groups_with_mem_pool_then_try_alter diff --git a/echo b/echo new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/test/sql/test_resource_group_mem_pool/R/test_create_resource_group_with_mem_pool b/test/sql/test_resource_group_mem_pool/R/test_create_resource_group_with_mem_pool new file mode 100644 index 00000000000000..a9739917b5dea3 --- /dev/null +++ b/test/sql/test_resource_group_mem_pool/R/test_create_resource_group_with_mem_pool @@ -0,0 +1,18 @@ +-- name: test_create_resource_group_with_mem_pool + +[UC] drop resource group shared_resource_group_for_test_user; + +[UC] create resource group shared_resource_group_for_test_user +to (user='test_user') +with ( + 'cpu_weight' = '12', + 'mem_limit' = '20%', + 'mem_pool' = 'test_pool_1' +); + +show verbose resource groups all; +-- result: +[REGEX]shared_resource_group_for_test_user.+12.+20(\.\d+)?%.+NORMAL.+\(id=\d+,.+user=test_user\)\s*(test_pool_1) +-- !result + +[UC] drop resource group shared_resource_group_for_test_user; \ No newline at end of file diff --git a/test/sql/test_resource_group_mem_pool/R/test_create_resource_group_with_mem_pool_then_try_alter b/test/sql/test_resource_group_mem_pool/R/test_create_resource_group_with_mem_pool_then_try_alter new file mode 100644 index 00000000000000..6b5998fbd2dbc1 --- /dev/null +++ b/test/sql/test_resource_group_mem_pool/R/test_create_resource_group_with_mem_pool_then_try_alter @@ -0,0 +1,46 @@ +-- name: test_create_resource_group_with_mem_pool_then_try_alter + +[UC] drop resource group shared_resource_group_for_james; + +[UC] create resource group shared_resource_group_for_james +to (user='james') +with ( + 'cpu_weight' = '9', + 'mem_limit' = '66%', + 'max_cpu_cores' = "8", + 'mem_pool' = 'mem_pool_for_james' +); + +show verbose resource groups all; +-- result: +[REGEX]shared_resource_group_for_james.+9.+66(\.\d+)?%.+8.+NORMAL.+\(id=\d+,.+user=james\)\s*(mem_pool_for_james) +-- !result + +alter resource group shared_resource_group_for_james with ( + 'mem_limit' = '99%', + 'mem_pool' = 'other_pool' +); +-- result: +E: (1064, 'Property `mem_pool` cannot be altered [mem_pool_for_james].') +-- !result + + +alter resource group shared_resource_group_for_james with ( + 'mem_limit' = '99%' +); +-- result: +E: (1064, 'Property `mem_limit` cannot be altered for resource groups with mem_pool [mem_pool_for_james].') +-- !result + +alter resource group shared_resource_group_for_james with ( + 'max_cpu_cores' = "1" +); +-- result: +-- !result + +show verbose resource groups all; +-- result: +[REGEX]shared_resource_group_for_james.+9.+66(\.\d+)?%.+1.+NORMAL.+\(id=\d+,.+user=james\)\s*(mem_pool_for_james) +-- !result + +[UC] drop resource group shared_resource_group_for_james; \ No newline at end of file diff --git a/test/sql/test_resource_group_mem_pool/R/test_create_two_resource_groups_with_mem_pool b/test/sql/test_resource_group_mem_pool/R/test_create_two_resource_groups_with_mem_pool new file mode 100644 index 00000000000000..57cdb8ad2f73cb --- /dev/null +++ b/test/sql/test_resource_group_mem_pool/R/test_create_two_resource_groups_with_mem_pool @@ -0,0 +1,35 @@ +-- name: test_create_two_resource_groups_with_mem_pool + +[UC] drop resource group shared_resource_group_for_john; +[UC] drop resource group shared_resource_group_for_jane; + +[UC] create resource group shared_resource_group_for_john +to (user='john') +with ( + 'cpu_weight' = '7', + 'mem_limit' = '55%', + 'mem_pool' = 'shared_pool_john_and_jane' +); + + +[UC] create resource group shared_resource_group_for_jane +to (user='jane') +with ( + 'cpu_weight' = '8', + 'mem_limit' = '55%', + 'mem_pool' = 'shared_pool_john_and_jane' +); + +show verbose resource groups all; +-- result: +[REGEX]shared_resource_group_for_john.+7.+55(\.\d+)?%.+NORMAL.+\(id=\d+,.+user=john\)\s*shared_pool_john_and_jane +-- !result + +show verbose resource groups all; +-- result: +[REGEX]shared_resource_group_for_jane.+8.+55(\.\d+)?%.+NORMAL.+\(id=\d+,.+user=jane\)\s*shared_pool_john_and_jane +-- !result + + +[UC] drop resource group shared_resource_group_for_john; +[UC] drop resource group shared_resource_group_for_jane; \ No newline at end of file diff --git a/test/sql/test_resource_group_mem_pool/R/test_create_two_resource_groups_with_mem_pool_different_mem_limit b/test/sql/test_resource_group_mem_pool/R/test_create_two_resource_groups_with_mem_pool_different_mem_limit new file mode 100644 index 00000000000000..25353e0066510c --- /dev/null +++ b/test/sql/test_resource_group_mem_pool/R/test_create_two_resource_groups_with_mem_pool_different_mem_limit @@ -0,0 +1,37 @@ +-- name: test_create_two_resource_groups_with_mem_pool_different_mem_limit + +[UC] drop resource group shared_resource_group_for_alex; +[UC] drop resource group shared_resource_group_for_brad; + +[UC] create resource group shared_resource_group_for_alex +to (user='alex') +with ( + 'cpu_weight' = '7', + 'mem_limit' = '55%', + 'mem_pool' = 'shared_pool_for_alex_and_brad' +); + +create resource group shared_resource_group_for_brad +to (user='brad') +with ( + 'cpu_weight' = '7', + 'mem_limit' = '88%', + 'mem_pool' = 'shared_pool_for_alex_and_brad' +); +-- result: +[REGEX]Property `mem_limit` must be equal for all resource groups using the mem_pool \[shared_pool_for_alex_and_brad\] +-- !result + +show verbose resource groups all; +-- result: +[REGEX]shared_resource_group_for_alex.+7.+55(\.\d+)?%.+NORMAL.+\(id=\d+,.+user=alex\)\s*(shared_pool_for_alex_and_brad) +-- !result + +show verbose resource groups all; +-- result: +[REGEX][^shared_resource_group_for_brad] +-- !result + + +[UC] drop resource group shared_resource_group_for_alex; +[UC] drop resource group shared_resource_group_for_brad; \ No newline at end of file diff --git a/test/sql/test_resource_group_mem_pool/R/test_create_two_resource_groups_with_mem_pool_then_try_alter b/test/sql/test_resource_group_mem_pool/R/test_create_two_resource_groups_with_mem_pool_then_try_alter new file mode 100644 index 00000000000000..ec4292729d1d37 --- /dev/null +++ b/test/sql/test_resource_group_mem_pool/R/test_create_two_resource_groups_with_mem_pool_then_try_alter @@ -0,0 +1,50 @@ +-- name: test_create_two_resource_groups_with_mem_pool_then_try_alter + +[UC] drop resource group shared_resource_group_for_skywalker; +[UC] drop resource group shared_resource_group_for_vader; + +[UC] create resource group shared_resource_group_for_skywalker +to (user='skywalker') +with ( + 'cpu_weight' = '2', + 'mem_limit' = '70%', + 'mem_pool' = 'shared_pool_skywalker_and_vader' +); + + +[UC] create resource group shared_resource_group_for_vader +to (user='vader') +with ( + 'cpu_weight' = '2', + 'mem_limit' = '70%', + 'mem_pool' = 'shared_pool_skywalker_and_vader' +); + +show verbose resource groups all; +-- result: +[REGEX]shared_resource_group_for_skywalker.+2.+70(\.\d+)?%.+NORMAL.+\(id=\d+,.+user=skywalker\)\s*shared_pool_skywalker_and_vader +-- !result + +show verbose resource groups all; +-- result: +[REGEX]shared_resource_group_for_vader.+2.+70(\.\d+)?%.+NORMAL.+\(id=\d+,.+user=vader\)\s*shared_pool_skywalker_and_vader +-- !result + +alter resource group shared_resource_group_for_vader with ( + 'mem_limit' = '99%', + 'mem_pool' = 'other_pool' +); +-- result: +E: (1064, 'Property `mem_pool` cannot be altered [shared_pool_skywalker_and_vader].') +-- !result + +alter resource group shared_resource_group_for_skywalker with ( + 'mem_limit' = '99%', + 'mem_pool' = 'other_pool' +); +-- result: +E: (1064, 'Property `mem_pool` cannot be altered [shared_pool_skywalker_and_vader].') +-- !result + +[UC] drop resource group shared_resource_group_for_skywalker; +[UC] drop resource group shared_resource_group_for_vader; \ No newline at end of file diff --git a/test/sql/test_resource_group_mem_pool/T/test_create_resource_group_with_mem_pool b/test/sql/test_resource_group_mem_pool/T/test_create_resource_group_with_mem_pool new file mode 100644 index 00000000000000..630059defff499 --- /dev/null +++ b/test/sql/test_resource_group_mem_pool/T/test_create_resource_group_with_mem_pool @@ -0,0 +1,15 @@ +-- name: test_create_resource_group_with_mem_pool + +[UC] drop resource group shared_resource_group_for_test_user; + +[UC] create resource group shared_resource_group_for_test_user +to (user='test_user') +with ( + 'cpu_weight' = '12', + 'mem_limit' = '20%', + 'mem_pool' = 'test_pool_1' +); + +show verbose resource groups all; + +[UC] drop resource group shared_resource_group_for_test_user; \ No newline at end of file diff --git a/test/sql/test_resource_group_mem_pool/T/test_create_resource_group_with_mem_pool_then_try_alter b/test/sql/test_resource_group_mem_pool/T/test_create_resource_group_with_mem_pool_then_try_alter new file mode 100644 index 00000000000000..9160f86e895c81 --- /dev/null +++ b/test/sql/test_resource_group_mem_pool/T/test_create_resource_group_with_mem_pool_then_try_alter @@ -0,0 +1,31 @@ +-- name: test_create_resource_group_with_mem_pool_then_try_alter + +[UC] drop resource group shared_resource_group_for_james; + +[UC] create resource group shared_resource_group_for_james +to (user='james') +with ( + 'cpu_weight' = '9', + 'mem_limit' = '66%', + 'max_cpu_cores' = "8", + 'mem_pool' = 'mem_pool_for_james' +); + +show verbose resource groups all; + +alter resource group shared_resource_group_for_james with ( + 'mem_limit' = '99%', + 'mem_pool' = 'other_pool' +); + +alter resource group shared_resource_group_for_james with ( + 'mem_limit' = '99%' +); + +alter resource group shared_resource_group_for_james with ( + 'max_cpu_cores' = "1" +); + +show verbose resource groups all; + +[UC] drop resource group shared_resource_group_for_james; \ No newline at end of file diff --git a/test/sql/test_resource_group_mem_pool/T/test_create_two_resource_groups_with_mem_pool b/test/sql/test_resource_group_mem_pool/T/test_create_two_resource_groups_with_mem_pool new file mode 100644 index 00000000000000..eb0a0cd2070ae9 --- /dev/null +++ b/test/sql/test_resource_group_mem_pool/T/test_create_two_resource_groups_with_mem_pool @@ -0,0 +1,27 @@ +-- name: test_create_two_resource_groups_with_mem_pool + +[UC] drop resource group shared_resource_group_for_john; +[UC] drop resource group shared_resource_group_for_jane; + +[UC] create resource group shared_resource_group_for_john +to (user='john') +with ( + 'cpu_weight' = '7', + 'mem_limit' = '55%', + 'mem_pool' = 'shared_pool_john_and_jane' +); + + +[UC] create resource group shared_resource_group_for_jane +to (user='jane') +with ( + 'cpu_weight' = '8', + 'mem_limit' = '55%', + 'mem_pool' = 'shared_pool_john_and_jane' +); + +show verbose resource groups all; +show verbose resource groups all; + +[UC] drop resource group shared_resource_group_for_john; +[UC] drop resource group shared_resource_group_for_jane; \ No newline at end of file diff --git a/test/sql/test_resource_group_mem_pool/T/test_create_two_resource_groups_with_mem_pool_different_mem_limit b/test/sql/test_resource_group_mem_pool/T/test_create_two_resource_groups_with_mem_pool_different_mem_limit new file mode 100644 index 00000000000000..56422c3a65a6e9 --- /dev/null +++ b/test/sql/test_resource_group_mem_pool/T/test_create_two_resource_groups_with_mem_pool_different_mem_limit @@ -0,0 +1,26 @@ +-- name: test_create_two_resource_groups_with_mem_pool_different_mem_limit + +[UC] drop resource group shared_resource_group_for_alex; +[UC] drop resource group shared_resource_group_for_brad; + +[UC] create resource group shared_resource_group_for_alex +to (user='alex') +with ( + 'cpu_weight' = '7', + 'mem_limit' = '55%', + 'mem_pool' = 'shared_pool_for_alex_and_brad' +); + +create resource group shared_resource_group_for_brad +to (user='brad') +with ( + 'cpu_weight' = '7', + 'mem_limit' = '88%', + 'mem_pool' = 'shared_pool_for_alex_and_brad' +); + +show verbose resource groups all; +show verbose resource groups all; + +[UC] drop resource group shared_resource_group_for_alex; +[UC] drop resource group shared_resource_group_for_brad; \ No newline at end of file diff --git a/test/sql/test_resource_group_mem_pool/T/test_create_two_resource_groups_with_mem_pool_then_try_alter b/test/sql/test_resource_group_mem_pool/T/test_create_two_resource_groups_with_mem_pool_then_try_alter new file mode 100644 index 00000000000000..7fa2c2ebf8af62 --- /dev/null +++ b/test/sql/test_resource_group_mem_pool/T/test_create_two_resource_groups_with_mem_pool_then_try_alter @@ -0,0 +1,38 @@ +-- name: test_create_two_resource_groups_with_mem_pool_then_try_alter + +[UC] drop resource group shared_resource_group_for_skywalker; +[UC] drop resource group shared_resource_group_for_vader; + +[UC] create resource group shared_resource_group_for_skywalker +to (user='skywalker') +with ( + 'cpu_weight' = '2', + 'mem_limit' = '70%', + 'mem_pool' = 'shared_pool_skywalker_and_vader' +); + + +[UC] create resource group shared_resource_group_for_vader +to (user='vader') +with ( + 'cpu_weight' = '2', + 'mem_limit' = '70%', + 'mem_pool' = 'shared_pool_skywalker_and_vader' +); + +show verbose resource groups all; + +show verbose resource groups all; + +alter resource group shared_resource_group_for_vader with ( + 'mem_limit' = '99%', + 'mem_pool' = 'other_pool' +); + +alter resource group shared_resource_group_for_skywalker with ( + 'mem_limit' = '99%', + 'mem_pool' = 'other_pool' +); + +[UC] drop resource group shared_resource_group_for_skywalker; +[UC] drop resource group shared_resource_group_for_vader; \ No newline at end of file