Skip to content

Commit 6f8a6c8

Browse files
arin-mirzaalvin-celerdata
authored andcommitted
Add SQL test cases for the new mem_pool functionality for resource groups
1 parent 0a05f31 commit 6f8a6c8

11 files changed

+323
-0
lines changed

echo

Whitespace-only changes.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
-- name: test_create_resource_group_with_mem_pool
2+
3+
[UC] drop resource group shared_resource_group_for_test_user;
4+
5+
[UC] create resource group shared_resource_group_for_test_user
6+
to (user='test_user')
7+
with (
8+
'cpu_weight' = '12',
9+
'mem_limit' = '20%',
10+
'mem_pool' = 'test_pool_1'
11+
);
12+
13+
show verbose resource groups all;
14+
-- result:
15+
[REGEX]shared_resource_group_for_test_user.+12.+20(\.\d+)?%.+NORMAL.+\(id=\d+,.+user=test_user\)\s*(test_pool_1)
16+
-- !result
17+
18+
[UC] drop resource group shared_resource_group_for_test_user;
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
-- name: test_create_resource_group_with_mem_pool_then_try_alter
2+
3+
[UC] drop resource group shared_resource_group_for_james;
4+
5+
[UC] create resource group shared_resource_group_for_james
6+
to (user='james')
7+
with (
8+
'cpu_weight' = '9',
9+
'mem_limit' = '66%',
10+
'max_cpu_cores' = "8",
11+
'mem_pool' = 'mem_pool_for_james'
12+
);
13+
14+
show verbose resource groups all;
15+
-- result:
16+
[REGEX]shared_resource_group_for_james.+9.+66(\.\d+)?%.+8.+NORMAL.+\(id=\d+,.+user=james\)\s*(mem_pool_for_james)
17+
-- !result
18+
19+
alter resource group shared_resource_group_for_james with (
20+
'mem_limit' = '99%',
21+
'mem_pool' = 'other_pool'
22+
);
23+
-- result:
24+
E: (1064, 'Property `mem_pool` cannot be altered [mem_pool_for_james].')
25+
-- !result
26+
27+
28+
alter resource group shared_resource_group_for_james with (
29+
'mem_limit' = '99%'
30+
);
31+
-- result:
32+
E: (1064, 'Property `mem_limit` cannot be altered for resource groups with mem_pool [mem_pool_for_james].')
33+
-- !result
34+
35+
alter resource group shared_resource_group_for_james with (
36+
'max_cpu_cores' = "1"
37+
);
38+
-- result:
39+
-- !result
40+
41+
show verbose resource groups all;
42+
-- result:
43+
[REGEX]shared_resource_group_for_james.+9.+66(\.\d+)?%.+1.+NORMAL.+\(id=\d+,.+user=james\)\s*(mem_pool_for_james)
44+
-- !result
45+
46+
[UC] drop resource group shared_resource_group_for_james;
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
-- name: test_create_two_resource_groups_with_mem_pool
2+
3+
[UC] drop resource group shared_resource_group_for_john;
4+
[UC] drop resource group shared_resource_group_for_jane;
5+
6+
[UC] create resource group shared_resource_group_for_john
7+
to (user='john')
8+
with (
9+
'cpu_weight' = '7',
10+
'mem_limit' = '55%',
11+
'mem_pool' = 'shared_pool_john_and_jane'
12+
);
13+
14+
15+
[UC] create resource group shared_resource_group_for_jane
16+
to (user='jane')
17+
with (
18+
'cpu_weight' = '8',
19+
'mem_limit' = '55%',
20+
'mem_pool' = 'shared_pool_john_and_jane'
21+
);
22+
23+
show verbose resource groups all;
24+
-- result:
25+
[REGEX]shared_resource_group_for_john.+7.+55(\.\d+)?%.+NORMAL.+\(id=\d+,.+user=john\)\s*shared_pool_john_and_jane
26+
-- !result
27+
28+
show verbose resource groups all;
29+
-- result:
30+
[REGEX]shared_resource_group_for_jane.+8.+55(\.\d+)?%.+NORMAL.+\(id=\d+,.+user=jane\)\s*shared_pool_john_and_jane
31+
-- !result
32+
33+
34+
[UC] drop resource group shared_resource_group_for_john;
35+
[UC] drop resource group shared_resource_group_for_jane;
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
-- name: test_create_two_resource_groups_with_mem_pool_different_mem_limit
2+
3+
[UC] drop resource group shared_resource_group_for_alex;
4+
[UC] drop resource group shared_resource_group_for_brad;
5+
6+
[UC] create resource group shared_resource_group_for_alex
7+
to (user='alex')
8+
with (
9+
'cpu_weight' = '7',
10+
'mem_limit' = '55%',
11+
'mem_pool' = 'shared_pool_for_alex_and_brad'
12+
);
13+
14+
create resource group shared_resource_group_for_brad
15+
to (user='brad')
16+
with (
17+
'cpu_weight' = '7',
18+
'mem_limit' = '88%',
19+
'mem_pool' = 'shared_pool_for_alex_and_brad'
20+
);
21+
-- result:
22+
[REGEX]Property `mem_limit` must be equal for all resource groups using the mem_pool \[shared_pool_for_alex_and_brad\]
23+
-- !result
24+
25+
show verbose resource groups all;
26+
-- result:
27+
[REGEX]shared_resource_group_for_alex.+7.+55(\.\d+)?%.+NORMAL.+\(id=\d+,.+user=alex\)\s*(shared_pool_for_alex_and_brad)
28+
-- !result
29+
30+
show verbose resource groups all;
31+
-- result:
32+
[REGEX][^shared_resource_group_for_brad]
33+
-- !result
34+
35+
36+
[UC] drop resource group shared_resource_group_for_alex;
37+
[UC] drop resource group shared_resource_group_for_brad;
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
-- name: test_create_two_resource_groups_with_mem_pool_then_try_alter
2+
3+
[UC] drop resource group shared_resource_group_for_skywalker;
4+
[UC] drop resource group shared_resource_group_for_vader;
5+
6+
[UC] create resource group shared_resource_group_for_skywalker
7+
to (user='skywalker')
8+
with (
9+
'cpu_weight' = '2',
10+
'mem_limit' = '70%',
11+
'mem_pool' = 'shared_pool_skywalker_and_vader'
12+
);
13+
14+
15+
[UC] create resource group shared_resource_group_for_vader
16+
to (user='vader')
17+
with (
18+
'cpu_weight' = '2',
19+
'mem_limit' = '70%',
20+
'mem_pool' = 'shared_pool_skywalker_and_vader'
21+
);
22+
23+
show verbose resource groups all;
24+
-- result:
25+
[REGEX]shared_resource_group_for_skywalker.+2.+70(\.\d+)?%.+NORMAL.+\(id=\d+,.+user=skywalker\)\s*shared_pool_skywalker_and_vader
26+
-- !result
27+
28+
show verbose resource groups all;
29+
-- result:
30+
[REGEX]shared_resource_group_for_vader.+2.+70(\.\d+)?%.+NORMAL.+\(id=\d+,.+user=vader\)\s*shared_pool_skywalker_and_vader
31+
-- !result
32+
33+
alter resource group shared_resource_group_for_vader with (
34+
'mem_limit' = '99%',
35+
'mem_pool' = 'other_pool'
36+
);
37+
-- result:
38+
E: (1064, 'Property `mem_pool` cannot be altered [shared_pool_skywalker_and_vader].')
39+
-- !result
40+
41+
alter resource group shared_resource_group_for_skywalker with (
42+
'mem_limit' = '99%',
43+
'mem_pool' = 'other_pool'
44+
);
45+
-- result:
46+
E: (1064, 'Property `mem_pool` cannot be altered [shared_pool_skywalker_and_vader].')
47+
-- !result
48+
49+
[UC] drop resource group shared_resource_group_for_skywalker;
50+
[UC] drop resource group shared_resource_group_for_vader;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
-- name: test_create_resource_group_with_mem_pool
2+
3+
[UC] drop resource group shared_resource_group_for_test_user;
4+
5+
[UC] create resource group shared_resource_group_for_test_user
6+
to (user='test_user')
7+
with (
8+
'cpu_weight' = '12',
9+
'mem_limit' = '20%',
10+
'mem_pool' = 'test_pool_1'
11+
);
12+
13+
show verbose resource groups all;
14+
15+
[UC] drop resource group shared_resource_group_for_test_user;
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
-- name: test_create_resource_group_with_mem_pool_then_try_alter
2+
3+
[UC] drop resource group shared_resource_group_for_james;
4+
5+
[UC] create resource group shared_resource_group_for_james
6+
to (user='james')
7+
with (
8+
'cpu_weight' = '9',
9+
'mem_limit' = '66%',
10+
'max_cpu_cores' = "8",
11+
'mem_pool' = 'mem_pool_for_james'
12+
);
13+
14+
show verbose resource groups all;
15+
16+
alter resource group shared_resource_group_for_james with (
17+
'mem_limit' = '99%',
18+
'mem_pool' = 'other_pool'
19+
);
20+
21+
alter resource group shared_resource_group_for_james with (
22+
'mem_limit' = '99%'
23+
);
24+
25+
alter resource group shared_resource_group_for_james with (
26+
'max_cpu_cores' = "1"
27+
);
28+
29+
show verbose resource groups all;
30+
31+
[UC] drop resource group shared_resource_group_for_james;
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
-- name: test_create_two_resource_groups_with_mem_pool
2+
3+
[UC] drop resource group shared_resource_group_for_john;
4+
[UC] drop resource group shared_resource_group_for_jane;
5+
6+
[UC] create resource group shared_resource_group_for_john
7+
to (user='john')
8+
with (
9+
'cpu_weight' = '7',
10+
'mem_limit' = '55%',
11+
'mem_pool' = 'shared_pool_john_and_jane'
12+
);
13+
14+
15+
[UC] create resource group shared_resource_group_for_jane
16+
to (user='jane')
17+
with (
18+
'cpu_weight' = '8',
19+
'mem_limit' = '55%',
20+
'mem_pool' = 'shared_pool_john_and_jane'
21+
);
22+
23+
show verbose resource groups all;
24+
show verbose resource groups all;
25+
26+
[UC] drop resource group shared_resource_group_for_john;
27+
[UC] drop resource group shared_resource_group_for_jane;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
-- name: test_create_two_resource_groups_with_mem_pool_different_mem_limit
2+
3+
[UC] drop resource group shared_resource_group_for_alex;
4+
[UC] drop resource group shared_resource_group_for_brad;
5+
6+
[UC] create resource group shared_resource_group_for_alex
7+
to (user='alex')
8+
with (
9+
'cpu_weight' = '7',
10+
'mem_limit' = '55%',
11+
'mem_pool' = 'shared_pool_for_alex_and_brad'
12+
);
13+
14+
create resource group shared_resource_group_for_brad
15+
to (user='brad')
16+
with (
17+
'cpu_weight' = '7',
18+
'mem_limit' = '88%',
19+
'mem_pool' = 'shared_pool_for_alex_and_brad'
20+
);
21+
22+
show verbose resource groups all;
23+
show verbose resource groups all;
24+
25+
[UC] drop resource group shared_resource_group_for_alex;
26+
[UC] drop resource group shared_resource_group_for_brad;

0 commit comments

Comments
 (0)