You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ranger.apache.org by Kirby Zhou <ki...@gmail.com> on 2022/03/02 10:32:49 UTC

Review Request 73879: RANGER-2095: unit test in old commit is meaningless, fixed here.

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/73879/
-----------------------------------------------------------

Review request for ranger.


Bugs: RANGER-2095
    https://issues.apache.org/jira/browse/RANGER-2095


Repository: ranger


Description
-------

The old commit is buggy and meaningless.
 
* testBlockAuditorRoleUserThrowsErrorForAuditKeyAdmin
* testBlockAuditorRoleUserThrowsErrorForAuditUserAdmin
* testBlockAuditorRoleUserSuccess

The 3 tests should test behavior of RangerBizUtil::blockAuditorRoleUser.
But it constructs a mocked RangerBizUtil, and stub blockAuditorRoleUser. The real RangerBizUtil::blockAuditorRoleUser is never being tested.

These @Mock annotated class members are invalid.

* currentUserSession
* vXResponse 
* context
* contextUtil

These members are not member of RangerBizUtil, so can not be injected into rangerBizUtil, we should not use it as class member.


Diffs
-----

  security-admin/src/test/java/org/apache/ranger/biz/TestRangerBizUtil.java 22e290a666deaac42fc0106302abd151e135bd47 


Diff: https://reviews.apache.org/r/73879/diff/1/


Testing
-------

mvn test


Thanks,

Kirby Zhou


Re: Review Request 73879: RANGER-3650: fix unit test of blockAuditorRoleUser

Posted by bhavik patel <bh...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/73879/#review224111
-----------------------------------------------------------


Ship it!




Ship It!

- bhavik patel


On March 2, 2022, 10:32 a.m., Kirby Zhou wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/73879/
> -----------------------------------------------------------
> 
> (Updated March 2, 2022, 10:32 a.m.)
> 
> 
> Review request for ranger.
> 
> 
> Bugs: RANGER-3650
>     https://issues.apache.org/jira/browse/RANGER-3650
> 
> 
> Repository: ranger
> 
> 
> Description
> -------
> 
> The old commit is buggy and meaningless.
>  
> * testBlockAuditorRoleUserThrowsErrorForAuditKeyAdmin
> * testBlockAuditorRoleUserThrowsErrorForAuditUserAdmin
> * testBlockAuditorRoleUserSuccess
> 
> The 3 tests should test behavior of RangerBizUtil::blockAuditorRoleUser.
> But it constructs a mocked RangerBizUtil, and stub blockAuditorRoleUser. The real RangerBizUtil::blockAuditorRoleUser is never being tested.
> 
> These @Mock annotated class members are invalid.
> 
> * currentUserSession
> * vXResponse 
> * context
> * contextUtil
> 
> These members are not member of RangerBizUtil, so can not be injected into rangerBizUtil, we should not use it as class member.
> 
> 
> Diffs
> -----
> 
>   security-admin/src/test/java/org/apache/ranger/biz/TestRangerBizUtil.java 22e290a666deaac42fc0106302abd151e135bd47 
> 
> 
> Diff: https://reviews.apache.org/r/73879/diff/2/
> 
> 
> Testing
> -------
> 
> mvn test
> 
> 
> Thanks,
> 
> Kirby Zhou
> 
>