@@ -86,7 +86,6 @@ groups() ->
86
86
write_non_existing_vhost ,
87
87
write_existing_vhost ,
88
88
check_vhost_exists ,
89
- get_existing_vhost_info ,
90
89
list_vhost_names ,
91
90
list_vhost_objects ,
92
91
update_non_existing_vhost ,
@@ -1577,27 +1576,39 @@ delete_vhost_and_check_resource_access(_) ->
1577
1576
? with (? assertEqual (
1578
1577
true ,
1579
1578
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 ))),
1585
1579
? with (check_storage (
1586
1580
_With ,
1587
1581
[{mnesia , rabbit_vhost , []},
1588
1582
{mnesia , rabbit_user , [User ]},
1589
- {mnesia , rabbit_user_permission , []},
1583
+ {mnesia , rabbit_user_permission , [UserPermission ]},
1590
1584
{khepri , [rabbit_db_vhost ],
1591
1585
#{}},
1592
1586
{khepri , [rabbit_db_user ],
1593
1587
#{? user_path (Username ) => User }}]))
1594
1588
],
1595
1589
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
+
1596
1607
? assertEqual (
1597
1608
ok ,
1598
1609
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 }]}],
1601
1612
[verbose ])).
1602
1613
1603
1614
% %
@@ -2514,29 +2525,45 @@ delete_vhost_and_check_topic_access(_) ->
2514
2525
Context #{routing_key => <<" something-else" >>}))),
2515
2526
? with (? assert (
2516
2527
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" >>}))),
2524
2528
? with (check_storage (
2525
2529
_With ,
2526
2530
[{mnesia , rabbit_vhost , []},
2527
2531
{mnesia , rabbit_user , [User ]},
2528
- {mnesia , rabbit_topic_permission , []},
2532
+ {mnesia , rabbit_topic_permission , [TopicPermission ]},
2529
2533
{khepri , [rabbit_db_vhost ],
2530
2534
#{}},
2531
2535
{khepri , [rabbit_db_user ],
2532
2536
#{? user_path (Username ) => User }}]))
2533
2537
],
2534
2538
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
+
2535
2562
? assertEqual (
2536
2563
ok ,
2537
2564
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 }]}],
2540
2567
[verbose ])).
2541
2568
2542
2569
% % -------------------------------------------------------------------
0 commit comments