Merge "Changing url of the reporting to original one"
[releng.git] / utils / test / testapi / README.rst
1 =============
2 opnfv-testapi
3 =============
4
5 **Test Results Collector of OPNFV Test Projects**:
6
7 This project aims to provide a common way of gathering all the test results for OPNFV
8 testing projects into a single place, and a unified way of getting those results for
9 testing analysis projects, such as Reporting/Bitergia Dashboard/Qtip. It exposes
10 Restful APIs for collecting results and pushing them into a MongoDB database.
11
12 If you are interested in how TestAPI looks like, please visit OPNFV's official `TestAPI Server`__
13
14 .. __: http://testresults.opnfv.org/test
15
16 Pre-requsites
17 =============
18
19 TestAPI leverages MongoDB as the data warehouse, in order to let it work
20 successfully, a MongoDB must be provided, the official MongoDB version in OPNFV
21 TestAPI is 3.2.6. And the database is **test_results_collection**, the five
22 collections are *users/pods/projects/testcases/scenarioes/results*. And thanks to
23 MongoDB's very user-friendly property, they don't need to be created in advance.
24
25 Running locally
26 ===============
27
28 Requirements
29 ^^^^^^^^^^^^
30
31 All requirements are listed in requirements.txt and should be
32 installed by 'pip install':
33
34     *pip install -r requirements.txt*
35
36 Installation
37 ^^^^^^^^^^^^
38
39     *python setup.py install*
40
41 After installation, configuration file etc/config.ini will be put under
42 /etc/opnfv_testapi/. And all the web relevant files under 3rd_party/static
43 will be in /user/local/share/opnfv_testapi as a totality.
44
45 Start Server
46 ^^^^^^^^^^^^
47
48     *opnfv-testapi [--config-file <config.ini>]*
49
50 If --config-file is provided, the specified configuration file will be employed
51 when starting the server, or else /etc/opnfv_testapi/config.ini will be utilized
52 by default.
53
54 After executing the command successfully, a TestAPI server will be started on
55 port 8000, to visit web portal, please access http://hostname:8000
56
57 Regarding swagger-ui website, please visit http://hostname:8000/swagger/spec.html
58
59 Running with container
60 ======================
61
62 TestAPI has already containerized, the docker image is opnfv/testapi:latest.
63
64 **Running the container not behind nginx:**
65
66 .. code-block:: shell
67
68     docker run -dti --name testapi -p expose_port:8000
69         -e "mongodb_url=mongodb://mongodb_ip:27017/"
70         -e "base_url=http://host_name:expose_port"
71         opnfv/testapi:latest
72
73 **Running the container behind nginx:**
74
75 .. code-block:: shell
76
77     docker run -dti --name testapi -p expose_port:8000
78         -e "mongodb_url=mongodb://mongodb_ip:27017/"
79         -e "base_url=http://nginx_url"
80         opnfv/testapi:latest
81
82 Unittest & pep8
83 ===============
84
85 All requirements for unit tests are outlined in test-requirements.txt, and in TestAPI project, tox is leveraged to drive the executing of unit tests and pep8 check
86
87 **Running unit tests**
88
89     *tox -e py27*
90
91 **Running pep8 check**
92
93     *tox -e pep8*