Felipe Monteiro | 7bc35dc | 2017-04-19 21:11:46 +0100 | [diff] [blame] | 1 | .. |
| 2 | |
DavidPurcell | 663aedf | 2017-01-03 10:01:14 -0500 | [diff] [blame] | 3 | ======== |
| 4 | Usage |
| 5 | ======== |
| 6 | |
Felipe Monteiro | 7942336 | 2017-06-01 21:53:03 +0100 | [diff] [blame^] | 7 | RBAC (API) Tests |
| 8 | ================ |
DavidPurcell | 663aedf | 2017-01-03 10:01:14 -0500 | [diff] [blame] | 9 | |
Felipe Monteiro | 7942336 | 2017-06-01 21:53:03 +0100 | [diff] [blame^] | 10 | If Patrole is installed correctly, then the RBAC tests can be executed |
| 11 | from inside the tempest root directory as follows:: |
DavidPurcell | 663aedf | 2017-01-03 10:01:14 -0500 | [diff] [blame] | 12 | |
Felipe Monteiro | 7942336 | 2017-06-01 21:53:03 +0100 | [diff] [blame^] | 13 | $ tox -eall-plugin -- patrole_tempest_plugin.tests.api |
Felipe Monteiro | 7bc35dc | 2017-04-19 21:11:46 +0100 | [diff] [blame] | 14 | |
Felipe Monteiro | 7942336 | 2017-06-01 21:53:03 +0100 | [diff] [blame^] | 15 | To execute patrole tests for a specific module, run:: |
Felipe Monteiro | 7bc35dc | 2017-04-19 21:11:46 +0100 | [diff] [blame] | 16 | |
Felipe Monteiro | 7942336 | 2017-06-01 21:53:03 +0100 | [diff] [blame^] | 17 | $ tox -eall-plugin -- patrole_tempest_plugin.tests.api.compute |
| 18 | |
| 19 | .. note:: |
| 20 | |
| 21 | It is possible to run Patrole via ``tox -eall`` in order to run Patrole |
| 22 | isolated from other plugins. This can be accomplished by including the |
| 23 | installation of services that currently use policy in code -- for example, |
| 24 | Nova and Keystone. For example:: |
| 25 | |
| 26 | $ tox -evenv-tempest -- pip install /opt/stack/patrole /opt/stack/keystone /opt/stack/nova |
| 27 | $ tox -eall -- patrole_tempest_plugin.tests.api |
| 28 | .. |
Felipe Monteiro | 7bc35dc | 2017-04-19 21:11:46 +0100 | [diff] [blame] | 29 | |
| 30 | To change the role that the patrole tests are being run as, edit |
| 31 | ``rbac_test_role`` in the ``rbac`` section of tempest.conf: :: |
| 32 | |
| 33 | [rbac] |
| 34 | rbac_test_role = Member |
| 35 | ... |
| 36 | |
| 37 | .. note:: |
| 38 | |
| 39 | The ``rbac_test_role`` is service-specific. Member, for example, |
| 40 | is an arbitrary role, but by convention is used to designate the default |
| 41 | non-admin role in the system. Most patrole tests should be run with |
| 42 | **admin** and **Member** roles. However, some services, like Heat, take |
| 43 | advantage of a role called **heat_stack_user**, as it appears frequently |
| 44 | in Heat's policy.json. |
| 45 | |
| 46 | For more information about the Member role, |
| 47 | please see: `<https://ask.openstack.org/en/question/4759/member-vs-_member_/>`__. |
Felipe Monteiro | 7942336 | 2017-06-01 21:53:03 +0100 | [diff] [blame^] | 48 | |
| 49 | Unit Tests |
| 50 | ========== |
| 51 | |
| 52 | Patrole includes unit tests for its RBAC framework. They can be run by |
| 53 | executing:: |
| 54 | |
| 55 | $ tox -e py27 |
| 56 | |
| 57 | or:: |
| 58 | |
| 59 | $ tox -e py35 |
| 60 | |
| 61 | against the Python 3.5 interpreter. |