> On Aug. 17, 2024, 5:09 a.m., Madhan Neethiraj wrote:
> > Abhishek - thank you for adding tests to cover Ranger REST APIs. Please 
> > review following suggestions:
> > 
> > 1. I suggest updating docker setup in dev-support/ranger-docker to make it 
> > easier to run the tests, probably in a new container named like 
> > ranger-tests. This can be integrated in CI to automatically run tests after 
> > a build.
> > 2. Adding/reviewing test payload in embedded json is cumbersome, given all 
> > quotes need to be escaped. Instead, consider having the payload in separate 
> > json files, replace the embedded json text with file names and update the 
> > test driver to read test payload from the given file.
> > 3. Having test results in a file could be helpful in troubleshooting 
> > failures.
> > 4. Have you considered using Ranger Python APIs 
> > (https://pypi.org/project/apache-ranger/) to call REST APIs, instead of raw 
> > requests package? This will help validate the Python APIs as well.
> > 5. I ran the tests per instructions in README-API_TESTS.txt, it looks like 
> > all tests failed!
> > ```
> > ============================= test session starts 
> > ==============================
> > platform darwin -- Python 3.9.6, pytest-8.3.2, pluggy-1.5.0
> > rootdir: 
> > /Users/mneethiraj/Apache/git/ranger/security-admin/src/test/python_tests
> > collected 244 items
> > 
> > test_runner.py F......F..FFFFFFFF.FFFFFF....FFFFFFFFFFF..FFFFF.FFFFFFFFF [ 
> > 23%]
> > FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF......F..FFFFFFFF.FFFFFF.F [ 
> > 52%]
> > ..FFFFFFFFFFF..FFFFF.FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF [ 
> > 82%]
> > FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF                              
> > [100%]
> > ```
> > 
> > ```
> > utils.py:313: AssertionError
> > ----------------------------- Captured stdout call 
> > -----------------------------
> > The request data is :- None
> > The request url is :- 
> > http://localhost:6080/service/public/v2/api/zones/name/lvyygmb
> > The response is :- <Response [401]>
> > The resp content is :- b'{"statusCode":401,"msgDesc":"Authentication 
> > Failed"}'
> > ```
> > 
> > I confirmed that username and password in data/ranger_admin_details.json 
> > are correct:
> > 
> > ```
> > {
> >   "base_url": "http://localhost:6080";,
> >   "admin_user": "admin",
> >   "key_admin_user": "keyadmin",
> >   "admin_user_password": "rangerR0cks!"
> > }
> > ```

Thanks for the review Madhan. Will look into these points


- Abhishek


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


On Dec. 21, 2023, 5:09 a.m., Abhishek Patil wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/74800/
> -----------------------------------------------------------
> 
> (Updated Dec. 21, 2023, 5:09 a.m.)
> 
> 
> Review request for ranger, Abhay Kulkarni, Madhan Neethiraj, Mehul Parikh, 
> Pradeep Agrawal, Ramesh Mani, Sailaja Polavarapu, and Velmurugan Periasamy.
> 
> 
> Bugs: RANGER-4620
>     https://issues.apache.org/jira/browse/RANGER-4620
> 
> 
> Repository: ranger
> 
> 
> Description
> -------
> 
> Add python based API tests for all the Public V2 REST APIs listed in 
> https://ranger.apache.org/apidocs/index.html.
> 
> The tests are cover almost all the Public V2 APIs available in Apache Ranger.
> 
> The tests are categorised into 5 sections :-
> 1. Tests for ROLE_SYS_ADMIN user
> 2. Tests for ROLE_ADMIN_AUDITOR user
> 3. Tests for ROLE_USER user
> 4. Tests for ROLE_KEY_ADMIN user
> 5. Negative test scenarios (for e.g fetch the entities using invalid id, make 
> an update request with invalid data etc)
> 
> The only input required to run these tests are Ranger Admin Base URL.
> There is a common test runner to run these tests, and the test suite is 
> specified in the form of a JSON file.
> The test runner reads the JSON file, creates the required data in the data 
> setup phase,
> and runs the tests.
> The same test runner can be used to run / automate tests for all the other 
> API sections like Asset REST, XUser REST, Plugin REST APIs etc.
> 
> Details on how new test suites can be specified / new tests can be added to 
> the existing test suite are specified in the README file.
> 
> 
> Diffs
> -----
> 
>   README-API_TESTS.txt PRE-CREATION 
>   security-admin/src/test/python_tests/data/public_v2_rest_apis.json 
> PRE-CREATION 
>   security-admin/src/test/python_tests/data/ranger_admin_details.json 
> PRE-CREATION 
>   security-admin/src/test/python_tests/test_runner.py PRE-CREATION 
>   security-admin/src/test/python_tests/utils.py PRE-CREATION 
> 
> 
> Diff: https://reviews.apache.org/r/74800/diff/1/
> 
> 
> Testing
> -------
> 
> Executed the tests against the latest release of Apache Ranger and ensured 
> that all the tests are passing.
> 
> 
> Thanks,
> 
> Abhishek Patil
> 
>

Reply via email to