!3890 【神舟通用】 测试用例user_host_test执行后会修改pg_hba,导致后续所有测试用例出错,执行完后应该还原pg_hba

Merge pull request !3890 from 雷紫薇/123933
This commit is contained in:
opengauss_bot
2024-11-25 01:33:03 +00:00
committed by Gitee
2 changed files with 9 additions and 1 deletions

View File

@ -54,6 +54,7 @@ grant select on test2 to 'test_user_host'@'127.0.%';
grant insert on test2 to 'test_user_host'@'127.0.%';
revoke insert on test2 from 'test_user_host'@'127.0.%';
\! echo 'b_compatibility_user_host_auth = on' >> @abs_srcdir@/tmp_check/datanode1/postgresql.conf
\! /usr/bin/cp @abs_srcdir@/tmp_check/datanode1/pg_hba.conf @abs_srcdir@/tmp_check/datanode1/pg_hba_bk.conf
\! sed -i 's#host.*all.*all.*127.0.0.1/32.*#host all all all sha256#g' @abs_srcdir@/tmp_check/datanode1/pg_hba.conf
\! @abs_bindir@/gs_ctl restart -D @abs_srcdir@/tmp_check/datanode1 > /dev/null
\! sleep 2
@ -65,3 +66,6 @@ revoke insert on test2 from 'test_user_host'@'127.0.%';
\! @abs_bindir@/gsql -p @portstring@ -h 127.0.0.1 -d user_host_db -r -U test_user_host -W 'test123@' -c "select current_user";
\! @abs_bindir@/gsql -p @portstring@ -h 127.0.0.1 -d user_host_db -r -U test_user_host -W 'test123@' -c "select * from test2";
\! @abs_bindir@/gsql -p @portstring@ -h 127.0.0.1 -d user_host_db -r -U test_user_host2 -W 'test123@' -c "select current_user";
\! /usr/bin/mv -f @abs_srcdir@/tmp_check/datanode1/pg_hba_bk.conf @abs_srcdir@/tmp_check/datanode1/pg_hba.conf
\! @abs_bindir@/gs_ctl restart -D @abs_srcdir@/tmp_check/datanode1 > /dev/null
\! sleep 5

View File

@ -111,6 +111,7 @@ revoke insert on test2 from 'test_user_host'@'127.0.%';
--?.*
--?.*
--?.*
--?.*
\! sleep 2
--?.*
gsql: FATAL: Invalid username/password,login denied.
@ -147,4 +148,7 @@ DROP ROLE
---------------------------
test_user_host2@localhost
(1 row)
--?.*
--?.*
--?.*
\! sleep 5