Codebase list python-castellan / 2e3219e
Merge "Add testing documentation to Castellan" Jenkins authored 8 years ago Gerrit Code Review committed 8 years ago
2 changed file(s) with 99 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
1313 readme
1414 installation
1515 usage
16 testing
1617 contributing
1718
1819 Indices and tables
0 =======
1 Testing
2 =======
3
4 Every Castellan code submission is automatically tested against a number
5 of gating jobs to prevent regressions. Castellan developers should have a
6 habit of running tests locally to ensure the code works as intended before
7 submission.
8
9 For your convenience we provide the ability to run all tests through
10 the ``tox`` utility. If you are unfamiliar with tox please see
11 refer to the `tox documentation`_ for assistance.
12
13 .. _`tox documentation`: https://tox.readthedocs.org/en/latest/
14
15 Unit Tests
16 ----------
17
18 Currently, we provide tox environments for a variety of different Python
19 versions. By default all available test environments within the tox
20 configuration will execute when calling ``tox``. If you want to run an
21 independent version, you can do so with the following command:
22
23 .. code-block:: bash
24
25 # Executes tests on Python 2.7
26 tox -e py27
27
28
29 .. note::
30
31 Other available environments are py34, py26, and pypy.
32
33 If you do not have the appropriate Python versions available, consider
34 setting up PyEnv to install multiple versions of Python. See the
35 documentation regarding `Setting up a Barbican development environment`_
36 for more information.
37
38 Functional Tests
39 ----------------
40
41 Unlike running unit tests, the functional tests require Barbican and
42 Keystone services to be running in order to execute. For more
43 information on this please see `Setting up a Barbican development environment`_
44 and `Using Keystone Middleware with Barbican`_
45
46 .. _`Setting up a Barbican development environment`: http://docs.openstack.org/developer/barbican/setup/dev.html
47 .. _`Using Keystone Middleware with Barbican`: http://docs.openstack.org/developer/barbican/setup/keystone.html
48
49 Castellan uses ``/etc/castellan/castellan-functional.conf`` in order to
50 run functional tests. A sample file can be generated by running:
51
52 .. code-block:: bash
53
54 # Generate a sample configuration file
55 tox -e genconfig
56
57 ``castellan/etc/castellan/castellan-functional.conf.sample`` is generated.
58 It must be renamed to ``castellan-functional.conf`` and placed in
59 ``/etc/castellan``.
60
61 The file should look something like the following:
62
63 .. code-block:: bash
64
65 [DEFAULT]
66
67 [identity]
68 username = 'admin'
69 password = 'openstack'
70 project_name = 'admin'
71 auth_url = 'http://localhost:5000/v3'
72
73 Once you have the appropriate services running and configured you can execute
74 the functional tests through tox.
75
76 .. code-block:: bash
77
78 # Execute Barbican Functional Tests
79 tox -e functional
80
81
82 By default, the functional tox job will use ``testr`` to execute the
83 functional tests.
84
85 Pep8 Check
86 ----------
87
88 Pep8 is a style guide for Python code. Castellan code should be have proper
89 style before submission. In order to ensure that pep8 tests can be run through
90 tox as follows:
91
92 .. code-block:: bash
93
94 # Checks python code style
95 tox -e pep8
96
97 Any comments on bad coding style will output to the terminal.