@@ -86,7 +86,6 @@ groups() ->
8686 write_non_existing_vhost ,
8787 write_existing_vhost ,
8888 check_vhost_exists ,
89- get_existing_vhost_info ,
9089 list_vhost_names ,
9190 list_vhost_objects ,
9291 update_non_existing_vhost ,
@@ -1577,27 +1576,39 @@ delete_vhost_and_check_resource_access(_) ->
15771576 ? with (? assertEqual (
15781577 true ,
15791578 delete_vhost (_With , VHostName ))),
1580- ? with (? assertNot (
1581- check_vhost_access (_With , Username , VHostName ))),
1582- ? with (? assertNot (
1583- check_resource_access (
1584- _With , Username , VHostName , " my-resource" , configure ))),
15851579 ? with (check_storage (
15861580 _With ,
15871581 [{mnesia , rabbit_vhost , []},
15881582 {mnesia , rabbit_user , [User ]},
1589- {mnesia , rabbit_user_permission , []},
1583+ {mnesia , rabbit_user_permission , [UserPermission ]},
15901584 {khepri , [rabbit_db_vhost ],
15911585 #{}},
15921586 {khepri , [rabbit_db_user ],
15931587 #{? user_path (Username ) => User }}]))
15941588 ],
15951589
1590+ % % In mnesia the permissions have to be deleted explicitly
1591+ % % Khepri permissions have a condition to automatically delete them
1592+ % % when the vhost is deleted
1593+ MnesiaTests =
1594+ [? with (? assert (
1595+ check_vhost_access (_With , Username , VHostName ))),
1596+ ? with (? assert (
1597+ check_resource_access (
1598+ _With , Username , VHostName , " my-resource" , configure )))],
1599+
1600+ KhepriTests =
1601+ [? with (? assertNot (
1602+ check_vhost_access (_With , Username , VHostName ))),
1603+ ? with (? assertNot (
1604+ check_resource_access (
1605+ _With , Username , VHostName , " my-resource" , configure )))],
1606+
15961607 ? assertEqual (
15971608 ok ,
15981609 eunit :test (
1599- [{setup , fun force_mnesia_use /0 , [{with , mnesia , Tests }]},
1600- {setup , fun force_khepri_use /0 , [{with , khepri , Tests }]}],
1610+ [{setup , fun force_mnesia_use /0 , [{with , mnesia , Tests ++ MnesiaTests }]},
1611+ {setup , fun force_khepri_use /0 , [{with , khepri , Tests ++ KhepriTests }]}],
16011612 [verbose ])).
16021613
16031614% %
@@ -2514,29 +2525,45 @@ delete_vhost_and_check_topic_access(_) ->
25142525 Context #{routing_key => <<" something-else" >>}))),
25152526 ? with (? assert (
25162527 delete_vhost (_With , VHostName ))),
2517- ? with (? assert (
2518- check_topic_access (
2519- _With , Username , VHostName , Exchange , read , Context ))),
2520- ? with (? assert (
2521- check_topic_access (
2522- _With , Username , VHostName , Exchange , read ,
2523- Context #{routing_key => <<" something-else" >>}))),
25242528 ? with (check_storage (
25252529 _With ,
25262530 [{mnesia , rabbit_vhost , []},
25272531 {mnesia , rabbit_user , [User ]},
2528- {mnesia , rabbit_topic_permission , []},
2532+ {mnesia , rabbit_topic_permission , [TopicPermission ]},
25292533 {khepri , [rabbit_db_vhost ],
25302534 #{}},
25312535 {khepri , [rabbit_db_user ],
25322536 #{? user_path (Username ) => User }}]))
25332537 ],
25342538
2539+ % % In mnesia the permissions have to be deleted explicitly
2540+ % % Khepri permissions have a condition to automatically delete them
2541+ % % when the vhost is deleted
2542+ MnesiaTests =
2543+ [? with (? assert (
2544+ check_topic_access (
2545+ _With , Username , VHostName , Exchange , read , Context ))),
2546+ ? with (? assertNot (
2547+ check_topic_access (
2548+ _With , Username , VHostName , Exchange , read ,
2549+ Context #{routing_key => <<" something-else" >>})))],
2550+
2551+ KhepriTests =
2552+ [? with (? assertEqual (
2553+ undefined ,
2554+ check_topic_access (
2555+ _With , Username , VHostName , Exchange , read , Context ))),
2556+ ? with (? assertEqual (
2557+ undefined ,
2558+ check_topic_access (
2559+ _With , Username , VHostName , Exchange , read ,
2560+ Context #{routing_key => <<" something-else" >>})))],
2561+
25352562 ? assertEqual (
25362563 ok ,
25372564 eunit :test (
2538- [{setup , fun force_mnesia_use /0 , [{with , mnesia , Tests }]},
2539- {setup , fun force_khepri_use /0 , [{with , khepri , Tests }]}],
2565+ [{setup , fun force_mnesia_use /0 , [{with , mnesia , Tests ++ MnesiaTests }]},
2566+ {setup , fun force_khepri_use /0 , [{with , khepri , Tests ++ KhepriTests }]}],
25402567 [verbose ])).
25412568
25422569% % -------------------------------------------------------------------
0 commit comments