Skip to content

Commit a2b221f

Browse files
gouhongshenmergify[bot]XuPeng-SH
authored andcommitted
fix failed BVT cases. (matrixorigin#22094)
### **User description** ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue #matrixorigin#21092 ## What this PR does / why we need it: fix failed BVT cases. ___ ### **PR Type** Bug fix, Tests ___ ### **Description** - Fix BVT test failures by removing unknown result placeholders - Update expected test results with actual query outputs - Correct session IDs and snapshot creation commands - Remove duplicate database drop statements ___ ### **Changes diagram** ```mermaid flowchart LR A["Test Files"] --> B["Remove Unknown Results"] B --> C["Update Expected Outputs"] C --> D["Fix Session IDs"] D --> E["Correct SQL Commands"] E --> F["Working BVT Tests"] ``` ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Tests</strong></td><td><details><summary>7 files</summary><table> <tr> <td><strong>pub_sub_improvement.result</strong><dd><code>Remove duplicate database drop error messages</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/matrixorigin/matrixone/pull/22094/files#diff-6715b97754ed50c80550019651625cd1116c4d0e70721d73af17ec7ade05a60f">+0/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>restore_dropped_account.result</strong><dd><code>Replace unknown results with actual query outputs</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/matrixorigin/matrixone/pull/22094/files#diff-8418a455da56c4a8918f4163f549c5f83fab4a2b505bd3a26a18c4dba34f752c">+101/-121</a></td> </tr> <tr> <td><strong>restore_dropped_account.sql</strong><dd><code>Fix session IDs and snapshot creation command</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/matrixorigin/matrixone/pull/22094/files#diff-416c07871963f456057dc1ed8c9f9651ee2de6e617490646ecef78bf4ca08bab">+15/-19</a>&nbsp; </td> </tr> <tr> <td><strong>restore_pub_to_new.result</strong><dd><code>Remove duplicate database entries from output</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/matrixorigin/matrixone/pull/22094/files#diff-2374d3095ff5490f152abd992a4996899c85c9e12e341fad2e960a08e0c712cb">+0/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>restore_pub_to_new.sql</strong><dd><code>Update session ID references in test</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/matrixorigin/matrixone/pull/22094/files#diff-e8e32a24f43273269abed002f2e8ea1a6c60df0f2980c043bd626c8733febe05">+4/-4</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>grant_privs_role.result</strong><dd><code>Update privilege test results and role names</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/matrixorigin/matrixone/pull/22094/files#diff-3f3a3f3711bbf338daab744a0850691be546290786b88ceb24f8c8cc3b18c51b">+40/-31</a>&nbsp; </td> </tr> <tr> <td><strong>grant_privs_role.sql</strong><dd><code>Fix table creation path and role names</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/matrixorigin/matrixone/pull/22094/files#diff-070e5a012987611b57a8d475c74e90b11ee1ac2bea10e499ad592afdf1b77921">+4/-4</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></details></td></tr></tr></tbody></table> ___ > <details> <summary> Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about Qodo Merge usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details> --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: XuPeng-SH <[email protected]>
1 parent 607d681 commit a2b221f

File tree

7 files changed

+164
-183
lines changed

7 files changed

+164
-183
lines changed

test/distributed/cases/publication_subscription/pub_sub_improvement.result

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,7 @@ drop database sub_database01;
233233
drop database sub_database02;
234234
drop database sub_database03;
235235
drop database sub_database01;
236-
Can't drop database 'sub_database01'; database doesn't exist
237236
drop database sub_database02;
238-
Can't drop database 'sub_database02'; database doesn't exist
239237
drop database database01;
240238
drop database database02;
241239
drop database database03;

test/distributed/cases/snapshot/restore_dropped_account.result

Lines changed: 101 additions & 121 deletions
Large diffs are not rendered by default.

test/distributed/cases/snapshot/restore_dropped_account.sql

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,10 @@ drop account acc01;
1616
drop snapshot spsp01;
1717

1818

19-
20-
21-
-- @bvt:issue#21092
2219
-- sys level snapshot restore nonsys dropped account
2320
drop account if exists acc02;
2421
create account acc02 admin_name = 'test_account' identified by '111';
25-
-- @session:id=2&user=acc02:test_account&password=111
22+
-- @session:id=1&user=acc02:test_account&password=111
2623
drop database if exists test01;
2724
create database test01;
2825
use test01;
@@ -222,10 +219,6 @@ create account acc03 admin_name = 'test_account' identified by '111';
222219
restore account acc03 from snapshot spsp03;
223220
drop account acc03;
224221
drop snapshot spsp03;
225-
-- @bvt:issue
226-
227-
228-
229222

230223

231224
-- cluster level snapshot restore cluster which contains dropped account
@@ -363,7 +356,7 @@ drop account acc06;
363356

364357
restore cluster from snapshot spsp06;
365358

366-
-- @session:id=8&user=acc04:test_account&password=111
359+
-- @session:id=7&user=acc04:test_account&password=111
367360
use test04;
368361
select * from t1;
369362
-- @ignore:1
@@ -372,15 +365,15 @@ select * from vtab32;
372365
select * from vtab64;
373366
-- @session
374367

375-
-- @session:id=9&user=acc05:test_account&password=111
368+
-- @session:id=8&user=acc05:test_account&password=111
376369
use test05;
377370
select * from length01;
378371
select * from t1;
379372
-- @ignore:1
380373
select * from test02;
381374
-- @session
382375

383-
-- @session:id=10&user=acc06:test_account&password=111
376+
-- @session:id=9&user=acc06:test_account&password=111
384377
use test06;
385378
select * from table01;
386379
select * from t2;
@@ -393,18 +386,21 @@ drop account acc06;
393386
drop snapshot spsp06;
394387

395388

396-
397-
-- @bvt:issue#21092
398389
-- abnormal test: nonsys restore the deleted account
399390
drop account if exists acc07;
400391
create account acc07 admin_name = 'test_account' identified by '111';
401-
-- @session:id=11&user=acc07:test_account&password=111
392+
402393
drop snapshot if exists spsp07;
403-
create snapshot spsp07 for account spsp07;
404-
-- @session
394+
create snapshot spsp07 for account acc07;
395+
405396
drop account acc07;
406-
-- @session:id=11&user=acc07:test_account&password=111
397+
407398
restore account acc07 from snapshot spsp07;
399+
400+
-- @session:id=11&user=acc07:test_account&password=111
401+
show databases;
408402
-- @session
409-
-- @bvt:issue
410-
show snapshots;
403+
404+
drop account acc07;
405+
drop snapshot spsp07;
406+
drop database restore_dropped_account;

test/distributed/cases/snapshot/restore_pub_to_new.result

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,6 @@ show publications;
8888
publication database tables sub_account subscribed_accounts create_time update_time comments
8989
show databases like 'db%';
9090
Database
91-
db09
92-
db10
9391
restore account acc01 from snapshot pub_sp to account acc03;
9492
show publications;
9593
publication database tables sub_account subscribed_accounts create_time update_time comments

test/distributed/cases/snapshot/restore_pub_to_new.sql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ insert into index03 values (9001,'1980-12-17', 'SMITH', 'CLERK', 'F', '2008-12-1
5555
drop snapshot if exists pub_sp;
5656
create snapshot pub_sp for account acc01;
5757

58-
-- @session:id=1&user=acc01:test_account&password=111
58+
-- @session:id=2&user=acc01:test_account&password=111
5959
drop publication if exists pub05;
6060
create publication pub05 database db09 account acc02 comment 'publish db09';
6161
drop publication if exists pub06;
@@ -64,7 +64,7 @@ create publication pub06 database db10 account acc02 comment 'publish db10';
6464
show publications;
6565
-- @session
6666

67-
-- @session:id=2&user=acc02:test_account&password=111
67+
-- @session:id=3&user=acc02:test_account&password=111
6868
drop database if exists sub05;
6969
create database sub05 from acc01 publication pub05;
7070
show databases;
@@ -83,15 +83,15 @@ show databases like 'db%';
8383

8484
drop account if exists acc03;
8585
create account acc03 admin_name 'test_account' identified by '111';
86-
-- @session:id=36&user=acc03:test_account&password=111
86+
-- @session:id=4&user=acc03:test_account&password=111
8787
-- @ignore:5,6
8888
show publications;
8989
show databases like 'db%';
9090
-- @session
9191

9292
restore account acc01 from snapshot pub_sp to account acc03;
9393

94-
-- @session:id=3&user=acc03:test_account&password=111
94+
-- @session:id=5&user=acc03:test_account&password=111
9595
-- @ignore:5,6
9696
show publications;
9797
show databases like 'db%';

test/distributed/cases/zz_accesscontrol/grant_privs_role.result

Lines changed: 40 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -264,12 +264,15 @@ user_grant_9 role_account_priv_8 table table ownership d.t
264264
select * from testdb4.table_1;
265265
internal error: do not have privilege to execute the statement
266266
delete from testdb4.table_1;
267-
insert into testdb5.table_2 values(20,'yeah',10.20);
268267
internal error: do not have privilege to execute the statement
268+
insert into testdb5.table_2 values(20,'yeah',10.20);
269269
update testdb5.table_2 set name='bread' where id=20;
270-
internal error: do not have privilege to execute the statement
271270
select * from testdb5.table_2;
272-
internal error: do not have privilege to execute the statement
271+
id name num
272+
3 pear 3.8
273+
4 orange 5.03
274+
9 8.0
275+
20 bread 10.2
273276
create user 'user_grant_10' identified by '123456';
274277
create role 'role_account_priv_9';
275278
create table grant_table_10(a int);
@@ -279,11 +282,11 @@ select user_name,role_name,obj_type,privilege_name,privilege_level from mo_catal
279282
user_name role_name obj_type privilege_name privilege_level
280283
user_grant_10 role_account_priv_9 table table all d.*
281284
insert into testdb4.table_1 values (10,'ccc',1.8),(11,'ddd',5.3);
282-
internal error: do not have privilege to execute the statement
283285
select * from testdb4.table_1;
284-
internal error: do not have privilege to execute the statement
286+
id name num
287+
10 ccc 1.8
288+
11 ddd 5.3
285289
update testdb4.table_1 set name='oppo' where id=10;
286-
internal error: do not have privilege to execute the statement
287290
delete from testdb4.table_1;
288291
select * from testdb4.table_1;
289292
internal error: do not have privilege to execute the statement
@@ -334,8 +337,7 @@ grant r1,r2,r3,r4,r5 to user1,user2,user3,user4,user5;
334337
select count(*) from mo_catalog.mo_user_grant,mo_catalog.mo_user,mo_catalog.mo_role_privs where mo_user_grant.user_id=mo_user.user_id and mo_role_privs.role_id=mo_user_grant.role_id and role_name in ('r1','r2','r3','r4','r5');
335338
count(*)
336339
99
337-
create table grant_table_10(a int);
338-
internal error: do not have privilege to execute the statement
340+
create table testdb5.grant_table_10(a int);
339341
grant create role on account * to r5;
340342
grant r5 to user1,user2,user3,user4,user5;
341343
select user_name,role_name,obj_type,privilege_name,privilege_level from mo_catalog.mo_user_grant,mo_catalog.mo_user,mo_catalog.mo_role_privs where mo_user_grant.user_id=mo_user.user_id and mo_role_privs.role_id=mo_user_grant.role_id and role_name in ('r5');
@@ -365,30 +367,32 @@ user5 r5 table insert *.*
365367
user5 r5 table update *.*
366368
user5 r5 database create table *.*
367369
user5 r5 account create role *
368-
create role test_role;
369-
internal error: do not have privilege to execute the statement
370-
select count(*) from mo_catalog.mo_role where role_name='test_role';
371-
internal error: do not have privilege to execute the statement
370+
create role test_role_2;
371+
select count(*) from mo_catalog.mo_role where role_name='test_role_2';
372+
count(*)
373+
1
372374
create user user11 identified by '12345678';
373375
grant select ,insert ,update on table *.* to r1,r2 with grant option;
374376
grant r1,r2 to r6,r7;
375377
select mr.role_name,mp.role_name,obj_type,privilege_name,privilege_level from mo_catalog.mo_role_grant mg,mo_catalog.mo_role mr ,mo_catalog.mo_role_privs mp where mg.grantee_id=mr.role_id and mg.granted_id = mp.role_id and mr.role_name in ('r6','r7');
376378
role_name role_name obj_type privilege_name privilege_level
377379
r6 r1 database create table *.*
378-
r7 r1 database create table *.*
379-
r6 r2 database create table *.*
380-
r7 r2 database create table *.*
380+
r6 r1 table table ownership d.t
381381
r6 r1 table select *.*
382-
r7 r1 table select *.*
383-
r6 r2 table select *.*
384-
r7 r2 table select *.*
385382
r6 r1 table insert *.*
386-
r7 r1 table insert *.*
387-
r6 r2 table insert *.*
388-
r7 r2 table insert *.*
389383
r6 r1 table update *.*
384+
r7 r1 database create table *.*
385+
r7 r1 table table ownership d.t
386+
r7 r1 table select *.*
387+
r7 r1 table insert *.*
390388
r7 r1 table update *.*
389+
r6 r2 database create table *.*
390+
r6 r2 table select *.*
391+
r6 r2 table insert *.*
391392
r6 r2 table update *.*
393+
r7 r2 database create table *.*
394+
r7 r2 table select *.*
395+
r7 r2 table insert *.*
392396
r7 r2 table update *.*
393397
create user user12 identified by '12345678';
394398
grant r2 to r8,r9,r10;
@@ -400,6 +404,7 @@ select role_name,obj_type,privilege_name,privilege_level,with_grant_option from
400404
role_name obj_type privilege_name privilege_level with_grant_option
401405
r1 database create table *.* false
402406
r2 database create table *.* false
407+
r1 table table ownership d.t false
403408
r1 table select *.* true
404409
r2 table select *.* true
405410
r1 table insert *.* true
@@ -411,10 +416,12 @@ grant r1,r2 to user1,user2;
411416
select user_name,role_name,obj_type,privilege_name,privilege_level from mo_catalog.mo_user_grant,mo_catalog.mo_user,mo_catalog.mo_role_privs where mo_user_grant.user_id=mo_user.user_id and mo_role_privs.role_id=mo_user_grant.role_id and user_name in ('user1','user2') and role_name in ('r1','r2');
412417
user_name role_name obj_type privilege_name privilege_level
413418
user1 r1 database create table *.*
419+
user1 r1 table table ownership d.t
414420
user1 r1 table select *.*
415421
user1 r1 table insert *.*
416422
user1 r1 table update *.*
417423
user2 r1 database create table *.*
424+
user2 r1 table table ownership d.t
418425
user2 r1 table select *.*
419426
user2 r1 table insert *.*
420427
user2 r1 table update *.*
@@ -431,23 +438,25 @@ grant r1,r2 to r6,r7;
431438
select mr.role_name,mp.role_name,obj_type,privilege_name,privilege_level from mo_catalog.mo_role_grant mg,mo_catalog.mo_role mr ,mo_catalog.mo_role_privs mp where mg.grantee_id=mr.role_id and mg.granted_id = mp.role_id and mr.role_name in ('r6','r7');
432439
role_name role_name obj_type privilege_name privilege_level
433440
r6 r1 database create table *.*
434-
r7 r1 database create table *.*
435-
r6 r2 database create table *.*
436-
r7 r2 database create table *.*
441+
r6 r1 table table ownership d.t
437442
r6 r1 table select *.*
438-
r7 r1 table select *.*
439-
r6 r2 table select *.*
440-
r7 r2 table select *.*
441443
r6 r1 table insert *.*
442-
r7 r1 table insert *.*
443-
r6 r2 table insert *.*
444-
r7 r2 table insert *.*
445444
r6 r1 table update *.*
445+
r7 r1 database create table *.*
446+
r7 r1 table table ownership d.t
447+
r7 r1 table select *.*
448+
r7 r1 table insert *.*
446449
r7 r1 table update *.*
450+
r6 r2 database create table *.*
451+
r6 r2 table select *.*
452+
r6 r2 table insert *.*
447453
r6 r2 table update *.*
454+
r7 r2 database create table *.*
455+
r7 r2 table select *.*
456+
r7 r2 table insert *.*
448457
r7 r2 table update *.*
449458
drop user if exists user1,user2,user3,user4,user5,user11,user12,testuser,user_grant_1,user_grant_3,user_grant_4,user_grant_5,user_grant_6,user_grant_7,user_grant_8,user_grant_9,user_grant_10,user_prepare_01;
450-
drop role if exists u_role,test_role,grant_role_1,role_sys_priv,role_account_priv_2,role_account_priv_3,role_account_priv_4,role_account_priv_5,role_account_priv_6,role_account_priv_7,role_account_priv_8,role_account_priv_9,role_account_priv_10,role_prepare_1;
459+
drop role if exists u_role,test_role,test_role_2,grant_role_1,role_sys_priv,role_account_priv_2,role_account_priv_3,role_account_priv_4,role_account_priv_5,role_account_priv_6,role_account_priv_7,role_account_priv_8,role_account_priv_9,role_account_priv_10,role_prepare_1;
451460
drop database if exists grant_db;
452461
drop database if exists testdb;
453462
drop database if exists testdb4;

test/distributed/cases/zz_accesscontrol/grant_privs_role.sql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,16 +253,16 @@ create user user1 identified by '12345678',user2 identified by '12345678',user3
253253
grant r1,r2,r3,r4,r5 to user1,user2,user3,user4,user5;
254254
select count(*) from mo_catalog.mo_user_grant,mo_catalog.mo_user,mo_catalog.mo_role_privs where mo_user_grant.user_id=mo_user.user_id and mo_role_privs.role_id=mo_user_grant.role_id and role_name in ('r1','r2','r3','r4','r5');
255255
-- @session:id=13&user=sys:user1:r1&password=12345678
256-
create table grant_table_10(a int);
256+
create table testdb5.grant_table_10(a int);
257257
-- @session
258258

259259
--一个role授权给多个用户
260260
grant create role on account * to r5;
261261
grant r5 to user1,user2,user3,user4,user5;
262262
select user_name,role_name,obj_type,privilege_name,privilege_level from mo_catalog.mo_user_grant,mo_catalog.mo_user,mo_catalog.mo_role_privs where mo_user_grant.user_id=mo_user.user_id and mo_role_privs.role_id=mo_user_grant.role_id and role_name in ('r5');
263263
-- @session:id=14&user=sys:user3:r5&password=12345678
264-
create role test_role;
265-
select count(*) from mo_catalog.mo_role where role_name='test_role';
264+
create role test_role_2;
265+
select count(*) from mo_catalog.mo_role where role_name='test_role_2';
266266
-- @session
267267

268268
--多个role授权给多个role
@@ -288,7 +288,7 @@ grant r1,r2 to r6,r7;
288288
select mr.role_name,mp.role_name,obj_type,privilege_name,privilege_level from mo_catalog.mo_role_grant mg,mo_catalog.mo_role mr ,mo_catalog.mo_role_privs mp where mg.grantee_id=mr.role_id and mg.granted_id = mp.role_id and mr.role_name in ('r6','r7');
289289

290290
drop user if exists user1,user2,user3,user4,user5,user11,user12,testuser,user_grant_1,user_grant_3,user_grant_4,user_grant_5,user_grant_6,user_grant_7,user_grant_8,user_grant_9,user_grant_10,user_prepare_01;
291-
drop role if exists u_role,test_role,grant_role_1,role_sys_priv,role_account_priv_2,role_account_priv_3,role_account_priv_4,role_account_priv_5,role_account_priv_6,role_account_priv_7,role_account_priv_8,role_account_priv_9,role_account_priv_10,role_prepare_1;
291+
drop role if exists u_role,test_role,test_role_2,grant_role_1,role_sys_priv,role_account_priv_2,role_account_priv_3,role_account_priv_4,role_account_priv_5,role_account_priv_6,role_account_priv_7,role_account_priv_8,role_account_priv_9,role_account_priv_10,role_prepare_1;
292292
drop database if exists grant_db;
293293
drop database if exists testdb;
294294
drop database if exists testdb4;

0 commit comments

Comments
 (0)