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 (Jira)" <ji...@apache.org> on 2022/03/02 10:54:00 UTC

[jira] [Created] (RANGER-3650) unit test of blockAuditorRoleUser in RANGER-2095 commit is meaningless.

kirby zhou created RANGER-3650:
----------------------------------

             Summary: unit test of blockAuditorRoleUser in RANGER-2095 commit is meaningless.
                 Key: RANGER-3650
                 URL: https://issues.apache.org/jira/browse/RANGER-3650
             Project: Ranger
          Issue Type: Bug
          Components: admin
    Affects Versions: 3.0.0, 2.3.0
            Reporter: kirby zhou


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.

 

New Patch is here https://reviews.apache.org/r/73879/



--
This message was sent by Atlassian Jira
(v8.20.1#820001)