提交 0c5af857 编写于 作者: N Ning Yu

Move all resgroup tests out of ICW.

As cgroup is now required to enable resgroup on linux and cgroup itself
requires privileged permission to setup & config, so resgroup tests will
fail or at least produce extra warnings in ICW pipeline. We moved them
to the installcheck-resgroup target as there is a standalone privileged
pipeline to run this target.

Also the tests are updated as the psql output format is different
between ICW and installcheck-resgroup.
上级 2650f728
-- ---------------------------------------------------------------------- -- ----------------------------------------------------------------------
-- Test: assign/alter a role to a resource group -- Test: assign/alter a role to a resource group
-- ---------------------------------------------------------------------- -- ----------------------------------------------------------------------
--start_ignore --start_ignore
DROP ROLE IF EXISTS rg_test_role; DROP ROLE IF EXISTS rg_test_role;
NOTICE: role "rg_test_role" does not exist, skipping NOTICE: role "rg_test_role" does not exist, skipping
--end_ignore --end_ignore
CREATE ROLE rg_test_role; CREATE ROLE rg_test_role;
NOTICE: resource group required -- using default resource group "default_group" CREATE
SELECT rolresgroup FROM pg_authid WHERE rolname = 'rg_test_role'; SELECT rolresgroup FROM pg_authid WHERE rolname = 'rg_test_role';
rolresgroup rolresgroup
------------- -----------
6437 6437
(1 row) (1 row)
ALTER ROLE rg_test_role RESOURCE GROUP non_exist_group; ALTER ROLE rg_test_role RESOURCE GROUP non_exist_group;
ERROR: resource group "non_exist_group" does not exist ERROR: resource group "non_exist_group" does not exist
SELECT rolresgroup FROM pg_authid WHERE rolname = 'rg_test_role'; SELECT rolresgroup FROM pg_authid WHERE rolname = 'rg_test_role';
rolresgroup rolresgroup
------------- -----------
6437 6437
(1 row) (1 row)
ALTER ROLE rg_test_role RESOURCE GROUP admin_group; ALTER ROLE rg_test_role RESOURCE GROUP admin_group;
ERROR: only superuser can be assigned to admin resgroup ERROR: only superuser can be assigned to admin resgroup
SELECT rolresgroup FROM pg_authid WHERE rolname = 'rg_test_role'; SELECT rolresgroup FROM pg_authid WHERE rolname = 'rg_test_role';
rolresgroup rolresgroup
------------- -----------
6437 6437
(1 row) (1 row)
ALTER ROLE rg_test_role RESOURCE GROUP none; ALTER ROLE rg_test_role RESOURCE GROUP none;
NOTICE: resource group required -- using default resource group "default_group" ALTER
SELECT rolresgroup FROM pg_authid WHERE rolname = 'rg_test_role'; SELECT rolresgroup FROM pg_authid WHERE rolname = 'rg_test_role';
rolresgroup rolresgroup
------------- -----------
6437 6437
(1 row) (1 row)
DROP ROLE rg_test_role; DROP ROLE rg_test_role;
DROP
CREATE ROLE rg_test_role SUPERUSER; CREATE ROLE rg_test_role SUPERUSER;
NOTICE: resource group required -- using admin resource group "admin_group" CREATE
SELECT rolresgroup FROM pg_authid WHERE rolname = 'rg_test_role'; SELECT rolresgroup FROM pg_authid WHERE rolname = 'rg_test_role';
rolresgroup rolresgroup
------------- -----------
6438 6438
(1 row) (1 row)
ALTER ROLE rg_test_role RESOURCE GROUP default_group; ALTER ROLE rg_test_role RESOURCE GROUP default_group;
ALTER
SELECT rolresgroup FROM pg_authid WHERE rolname = 'rg_test_role'; SELECT rolresgroup FROM pg_authid WHERE rolname = 'rg_test_role';
rolresgroup rolresgroup
------------- -----------
6437 6437
(1 row) (1 row)
ALTER ROLE rg_test_role RESOURCE GROUP none; ALTER ROLE rg_test_role RESOURCE GROUP none;
NOTICE: resource group required -- using default resource group "admin_group" ALTER
SELECT rolresgroup FROM pg_authid WHERE rolname = 'rg_test_role'; SELECT rolresgroup FROM pg_authid WHERE rolname = 'rg_test_role';
rolresgroup rolresgroup
------------- -----------
6438 6438
(1 row) (1 row)
DROP ROLE rg_test_role; DROP ROLE rg_test_role;
DROP
CREATE ROLE rg_test_role RESOURCE GROUP non_exist_group; CREATE ROLE rg_test_role RESOURCE GROUP non_exist_group;
ERROR: resource group "non_exist_group" does not exist ERROR: resource group "non_exist_group" does not exist
-- nonsuper user should not be assigned to admin group -- nonsuper user should not be assigned to admin group
CREATE ROLE rg_test_role RESOURCE GROUP admin_group; CREATE ROLE rg_test_role RESOURCE GROUP admin_group;
ERROR: only superuser can be assigned to admin resgroup ERROR: only superuser can be assigned to admin resgroup
-- ---------------------------------------------------------------------- -- ----------------------------------------------------------------------
-- Test: create/drop a resource group -- Test: create/drop a resource group
-- ---------------------------------------------------------------------- -- ----------------------------------------------------------------------
--start_ignore --start_ignore
DROP RESOURCE GROUP rg_test_group; DROP RESOURCE GROUP rg_test_group;
ERROR: resource group "rg_test_group" does not exist ERROR: resource group "rg_test_group" does not exist
--end_ignore --end_ignore
-- can't drop non-exist resource group -- can't drop non-exist resource group
DROP RESOURCE GROUP rg_test_group; DROP RESOURCE GROUP rg_test_group;
ERROR: resource group "rg_test_group" does not exist ERROR: resource group "rg_test_group" does not exist
-- can't create the reserved resource groups -- can't create the reserved resource groups
CREATE RESOURCE GROUP default_group WITH (concurrency=1, cpu_rate_limit=.5, memory_limit=.5, memory_redzone_limit=.7); CREATE RESOURCE GROUP default_group WITH (concurrency=1, cpu_rate_limit=.5, memory_limit=.5, memory_redzone_limit=.7);
ERROR: resource group "default_group" already exists ERROR: resource group "default_group" already exists
...@@ -84,21 +89,25 @@ CREATE RESOURCE GROUP admin_group WITH (concurrency=1, cpu_rate_limit=.5, memory ...@@ -84,21 +89,25 @@ CREATE RESOURCE GROUP admin_group WITH (concurrency=1, cpu_rate_limit=.5, memory
ERROR: resource group "admin_group" already exists ERROR: resource group "admin_group" already exists
CREATE RESOURCE GROUP none WITH (concurrency=1, cpu_rate_limit=.5, memory_limit=.5, memory_redzone_limit=.7); CREATE RESOURCE GROUP none WITH (concurrency=1, cpu_rate_limit=.5, memory_limit=.5, memory_redzone_limit=.7);
ERROR: resource group name "none" is reserved ERROR: resource group name "none" is reserved
-- must specify both memory_limit and cpu_rate_limit -- must specify both memory_limit and cpu_rate_limit
CREATE RESOURCE GROUP rg_test_group WITH (concurrency=1, memory_limit=.5, memory_redzone_limit=.7); CREATE RESOURCE GROUP rg_test_group WITH (concurrency=1, memory_limit=.5, memory_redzone_limit=.7);
ERROR: must specify both memory_limit and cpu_rate_limit ERROR: must specify both memory_limit and cpu_rate_limit
CREATE RESOURCE GROUP rg_test_group WITH (concurrency=1, cpu_rate_limit=.5, memory_redzone_limit=.7); CREATE RESOURCE GROUP rg_test_group WITH (concurrency=1, cpu_rate_limit=.5, memory_redzone_limit=.7);
ERROR: must specify both memory_limit and cpu_rate_limit ERROR: must specify both memory_limit and cpu_rate_limit
CREATE RESOURCE GROUP rg_test_group WITH (concurrency=1, cpu_rate_limit=.5, memory_limit=.6, memory_redzone_limit=.7); CREATE RESOURCE GROUP rg_test_group WITH (concurrency=1, cpu_rate_limit=.5, memory_limit=.6, memory_redzone_limit=.7);
CREATE
SELECT groupname,concurrency,proposed_concurrency,cpu_rate_limit,memory_limit,proposed_memory_limit,memory_redzone_limit FROM gp_toolkit.gp_resgroup_config WHERE groupname='rg_test_group'; SELECT groupname,concurrency,proposed_concurrency,cpu_rate_limit,memory_limit,proposed_memory_limit,memory_redzone_limit FROM gp_toolkit.gp_resgroup_config WHERE groupname='rg_test_group';
groupname | concurrency | proposed_concurrency | cpu_rate_limit | memory_limit | proposed_memory_limit | memory_redzone_limit groupname |concurrency|proposed_concurrency|cpu_rate_limit|memory_limit|proposed_memory_limit|memory_redzone_limit
---------------+-------------+----------------------+----------------+--------------+-----------------------+---------------------- -------------+-----------+--------------------+--------------+------------+---------------------+--------------------
rg_test_group | 1 | 1 | 0.50 | 0.60 | 0.60 | 0.70 rg_test_group|1 |1 |0.50 |0.60 |0.60 |0.70
(1 row) (1 row)
-- multiple resource groups can't share the same name -- multiple resource groups can't share the same name
CREATE RESOURCE GROUP rg_test_group WITH (concurrency=1, cpu_rate_limit=.05, memory_limit=.05, memory_redzone_limit=.7); CREATE RESOURCE GROUP rg_test_group WITH (concurrency=1, cpu_rate_limit=.05, memory_limit=.05, memory_redzone_limit=.7);
ERROR: resource group "rg_test_group" already exists ERROR: resource group "rg_test_group" already exists
-- cpu_rate_limit/memory_limit range is (0.01, 1) -- cpu_rate_limit/memory_limit range is (0.01, 1)
CREATE RESOURCE GROUP rg2_test_group WITH (cpu_rate_limit=.5, memory_limit=.05); CREATE RESOURCE GROUP rg2_test_group WITH (cpu_rate_limit=.5, memory_limit=.05);
ERROR: total cpu_rate_limit exceeded the limit of 1.0 ERROR: total cpu_rate_limit exceeded the limit of 1.0
...@@ -108,6 +117,7 @@ CREATE RESOURCE GROUP rg2_test_group WITH (cpu_rate_limit=.01, memory_limit=.05) ...@@ -108,6 +117,7 @@ CREATE RESOURCE GROUP rg2_test_group WITH (cpu_rate_limit=.01, memory_limit=.05)
ERROR: cpu_rate_limit range is (.01, 1) ERROR: cpu_rate_limit range is (.01, 1)
CREATE RESOURCE GROUP rg2_test_group WITH (cpu_rate_limit=.05, memory_limit=.01); CREATE RESOURCE GROUP rg2_test_group WITH (cpu_rate_limit=.05, memory_limit=.01);
ERROR: memory_limit range is (.01, 1) ERROR: memory_limit range is (.01, 1)
-- can't specify the resource limit type multiple times -- can't specify the resource limit type multiple times
CREATE RESOURCE GROUP rg2_test_group WITH (concurrency=1, cpu_rate_limit=.05, memory_limit=.05, memory_redzone_limit=.7, concurrency=1); CREATE RESOURCE GROUP rg2_test_group WITH (concurrency=1, cpu_rate_limit=.05, memory_limit=.05, memory_redzone_limit=.7, concurrency=1);
ERROR: Find duplicate resoure group resource type: concurrency ERROR: Find duplicate resoure group resource type: concurrency
...@@ -117,7 +127,10 @@ CREATE RESOURCE GROUP rg2_test_group WITH (concurrency=1, cpu_rate_limit=.05, me ...@@ -117,7 +127,10 @@ CREATE RESOURCE GROUP rg2_test_group WITH (concurrency=1, cpu_rate_limit=.05, me
ERROR: Find duplicate resoure group resource type: memory_limit ERROR: Find duplicate resoure group resource type: memory_limit
CREATE RESOURCE GROUP rg2_test_group WITH (concurrency=1, cpu_rate_limit=.05, memory_limit=.05, memory_redzone_limit=.7, memory_redzone_limit=.8); CREATE RESOURCE GROUP rg2_test_group WITH (concurrency=1, cpu_rate_limit=.05, memory_limit=.05, memory_redzone_limit=.7, memory_redzone_limit=.8);
ERROR: Find duplicate resoure group resource type: memory_redzone_limit ERROR: Find duplicate resoure group resource type: memory_redzone_limit
DROP RESOURCE GROUP rg_test_group; DROP RESOURCE GROUP rg_test_group;
DROP
-- can't drop reserved resource groups -- can't drop reserved resource groups
DROP RESOURCE GROUP default_group; DROP RESOURCE GROUP default_group;
ERROR: cannot drop default resource group "default_group" ERROR: cannot drop default resource group "default_group"
...@@ -125,13 +138,17 @@ DROP RESOURCE GROUP admin_group; ...@@ -125,13 +138,17 @@ DROP RESOURCE GROUP admin_group;
ERROR: cannot drop default resource group "admin_group" ERROR: cannot drop default resource group "admin_group"
DROP RESOURCE GROUP none; DROP RESOURCE GROUP none;
ERROR: resource group "none" does not exist ERROR: resource group "none" does not exist
-- can't drop non-exist resource group -- can't drop non-exist resource group
DROP RESOURCE GROUP rg_non_exist_group; DROP RESOURCE GROUP rg_non_exist_group;
ERROR: resource group "rg_non_exist_group" does not exist ERROR: resource group "rg_non_exist_group" does not exist
-- ---------------------------------------------------------------------- -- ----------------------------------------------------------------------
-- Test: alter a resource group -- Test: alter a resource group
-- ---------------------------------------------------------------------- -- ----------------------------------------------------------------------
CREATE RESOURCE GROUP rg_test_group WITH (concurrency=1, cpu_rate_limit=.05, memory_limit=.05, memory_redzone_limit=.7); CREATE RESOURCE GROUP rg_test_group WITH (concurrency=1, cpu_rate_limit=.05, memory_limit=.05, memory_redzone_limit=.7);
CREATE
-- ALTER RESOURCE GROUP SET CONCURRENCY N -- ALTER RESOURCE GROUP SET CONCURRENCY N
-- negative -- negative
ALTER RESOURCE GROUP rg_test_group SET CONCURRENCY -2; ALTER RESOURCE GROUP rg_test_group SET CONCURRENCY -2;
...@@ -156,9 +173,15 @@ ALTER RESOURCE GROUP rg_test_group SET CONCURRENCY '1'; ...@@ -156,9 +173,15 @@ ALTER RESOURCE GROUP rg_test_group SET CONCURRENCY '1';
ERROR: syntax error at or near "'1'" ERROR: syntax error at or near "'1'"
LINE 1: ALTER RESOURCE GROUP rg_test_group SET CONCURRENCY '1'; LINE 1: ALTER RESOURCE GROUP rg_test_group SET CONCURRENCY '1';
^ ^
-- positive -- positive
ALTER RESOURCE GROUP rg_test_group SET CONCURRENCY -1; ALTER RESOURCE GROUP rg_test_group SET CONCURRENCY -1;
ALTER
ALTER RESOURCE GROUP rg_test_group SET CONCURRENCY 1; ALTER RESOURCE GROUP rg_test_group SET CONCURRENCY 1;
ALTER
ALTER RESOURCE GROUP rg_test_group SET CONCURRENCY 2; ALTER RESOURCE GROUP rg_test_group SET CONCURRENCY 2;
ALTER
ALTER RESOURCE GROUP rg_test_group SET CONCURRENCY 1000; ALTER RESOURCE GROUP rg_test_group SET CONCURRENCY 1000;
ALTER
DROP RESOURCE GROUP rg_test_group; DROP RESOURCE GROUP rg_test_group;
DROP
test: resgroup/enable_resgroup_validate test: resgroup/enable_resgroup_validate
test: resgroup/enable_resgroup test: resgroup/enable_resgroup
test: resgroup/resgroup_syntax
test: resgroup/resgroup_cpu_rate_limit test: resgroup/resgroup_cpu_rate_limit
test: resgroup/resgroup_concurrency test: resgroup/resgroup_concurrency
test: resgroup/drop_resgroup test: resgroup/drop_resgroup
......
--
-- Clean up for resource_group.sql tests
--
-- start_ignore
\! gpconfig -r gp_resource_manager
\! PGDATESTYLE="" gpstop -rai
-- end_ignore
--
-- Setup for resource_group.sql tests
--
-- We are setting gp_resource_manager to be 'group' to enable resource group.
-- start_ignore
\! gpconfig -c gp_resource_manager -v group
\! PGDATESTYLE="" gpstop -rai
-- end_ignore
...@@ -75,11 +75,6 @@ test: resource_queue ...@@ -75,11 +75,6 @@ test: resource_queue
test: resource_queue_function test: resource_queue_function
test: wrkloadadmin test: wrkloadadmin
# set gp_resource_manager and restart cluster to enable resource group
test: resource_group_setup
test: resource_group
test: resource_group_cleanup
# gp_toolkit performs a vacuum and checks that it truncated the relation. That # gp_toolkit performs a vacuum and checks that it truncated the relation. That
# might not happen if other backends are holding transactions open, preventing # might not happen if other backends are holding transactions open, preventing
# vacuum from removing dead tuples. # vacuum from removing dead tuples.
......
--
-- Clean up for resource_group.sql tests
--
-- start_ignore
\! gpconfig -r gp_resource_manager
\! PGDATESTYLE="" gpstop -rai
-- end_ignore
--
-- Setup for resource_group.sql tests
--
-- We are setting gp_resource_manager to be 'group' to enable resource group.
-- start_ignore
\! gpconfig -c gp_resource_manager -v group
\! PGDATESTYLE="" gpstop -rai
-- end_ignore
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册