update testing doc
This commit is contained in:
parent
d21096e770
commit
4c55f10262
99
testing.md
99
testing.md
|
@ -1,28 +1,21 @@
|
|||
Testing
|
||||
-------
|
||||
# Testing
|
||||
|
||||
In order to run tests you need to install `Tox`:
|
||||
## Requirements
|
||||
|
||||
$ pip install tox
|
||||
* Install `Tox`
|
||||
|
||||
Also, you will need a running MySQL instance with the database migrations applied from the previous step.
|
||||
Tests are dependent on pre-created MySQL database for persistence.
|
||||
Please set env var
|
||||
$ pip install tox
|
||||
|
||||
$ export TEST_DB_URI=mysql://<your-user>:<your-user-password>@<mysql-host>:<mysql-port>/<functions-db>
|
||||
* MySQL instance with database migrations applied (refer to quick start guide)
|
||||
|
||||
PEP8 style checks
|
||||
-----------------
|
||||
$ export TEST_DB_URI=mysql://<your-user>:<your-user-password>@<mysql-host>:<mysql-port>/<functions-db>
|
||||
|
||||
In order to run `PEP8` style checks run following command:
|
||||
### PEP8 style checks
|
||||
|
||||
$ tox -e pep8
|
||||
|
||||
|
||||
Functional testing
|
||||
------------------
|
||||
|
||||
In order to run `functional` tests run following command:
|
||||
### Functional testing
|
||||
|
||||
$ tox -e py35-functional
|
||||
|
||||
|
@ -38,10 +31,9 @@ Cons:
|
|||
* OpenStack authentication is not tested
|
||||
* IronFunctions API stubbed with fake implementation
|
||||
|
||||
Integration integrations
|
||||
------------------------
|
||||
### Integration tests
|
||||
|
||||
Integration tests are dependent on following env variables:
|
||||
The following env variables are required:
|
||||
|
||||
* TEST_DB_URI - similar to functional tests, database endpoint
|
||||
* FUNCTIONS_API_URL - IronFunctions API URL (default value - `http://localhost:8080/v1`)
|
||||
|
@ -50,63 +42,52 @@ Integration tests are dependent on following env variables:
|
|||
* OS_USERNAME - OpenStack user name
|
||||
* OS_PASSWORD - OpenStack user user password
|
||||
|
||||
To run tests use following command:
|
||||
```bash
|
||||
export TEST_DB_URI=mysql://<your-user>:<your-user-password>@<mysql-host>:<mysql-port>/<functions-db>
|
||||
export FUNCTIONS_API_URL=<functions-api-protocol>://<functions-host>:<functions-port>/<functions-api-version>
|
||||
export OS_AUTH_URL=<identity-api-protocol>://<identity-host>:<identity-port>/<identity-api-version>
|
||||
export OS_PROJECT_NAME=<project-name>
|
||||
export OS_USERNAME=<project-name>
|
||||
export OS_PASSWORD=<project-name>
|
||||
tox -epy35-integration
|
||||
```
|
||||
|
||||
export TEST_DB_URI=mysql://<your-user>:<your-user-password>@<mysql-host>:<mysql-port>/<functions-db>
|
||||
export FUNCTIONS_API_URL=<functions-api-protocol>://<functions-host>:<functions-port>/<functions-api-version>
|
||||
export OS_AUTH_URL=<identity-api-protocol>://<identity-host>:<identity-port>/<identity-api-version>
|
||||
export OS_PROJECT_NAME=<project-name>
|
||||
export OS_USERNAME=<project-name>
|
||||
export OS_PASSWORD=<project-name>
|
||||
tox -epy35-integration
|
||||
### Testing: Docker-build
|
||||
|
||||
Testing: Docker-build
|
||||
---------------------
|
||||
|
||||
This type of testing allows to ensure if code can be build inside docker container with no problems.
|
||||
In order to run this check use following commands::
|
||||
|
||||
export DOCKER_HOST=tcp://<docker-host>:<docker-port>>
|
||||
export TEST_DB_URI=mysql://<your-user>:<your-user-password>@<mysql-host>:<mysql-port>/<functions-db>
|
||||
export FUNCTIONS_API_URL=<functions-api-protocol>://<functions-host>:<functions-port>/<functions-api-version>
|
||||
export OS_AUTH_URL=<identity-api-protocol>://<identity-host>:<identity-port>/<identity-api-version>
|
||||
tox -e docker-build
|
||||
|
||||
During this check Tox:
|
||||
The following operations are performed:
|
||||
|
||||
* builds an image
|
||||
* deletes all artifacts (Python3.5 image and recently built image)
|
||||
|
||||
Testing Docker-full
|
||||
-------------------
|
||||
```bash
|
||||
export DOCKER_HOST=tcp://<docker-host>:<docker-port>>
|
||||
export TEST_DB_URI=mysql://<your-user>:<your-user-password>@<mysql-host>:<mysql-port>/<functions-db>
|
||||
export FUNCTIONS_API_URL=<functions-api-protocol>://<functions-host>:<functions-port>/<functions-api-version>
|
||||
export OS_AUTH_URL=<identity-api-protocol>://<identity-host>:<identity-port>/<identity-api-version>
|
||||
tox -e docker-build
|
||||
```
|
||||
|
||||
This type of testing allows to ensure if code code can be build and run successfully inside docker container with no problems.
|
||||
In order to run this check use following commands::
|
||||
### Testing Docker-full
|
||||
|
||||
export DOCKER_HOST=tcp://<docker-host>:<docker-port>>
|
||||
export TEST_DB_URI=mysql://<your-user>:<your-user-password>@<mysql-host>:<mysql-port>/<functions-db>
|
||||
export FUNCTIONS_API_URL=<functions-api-protocol>://<functions-host>:<functions-port>/<functions-api-version>
|
||||
export OS_AUTH_URL=<identity-api-protocol>://<identity-host>:<identity-port>/<identity-api-version>
|
||||
tox -e docker-full
|
||||
|
||||
During this check following operations are performed::
|
||||
The following operations are performed:
|
||||
|
||||
* build container from source code
|
||||
* run container with exposed ports
|
||||
* request Swagger API doc to see if API is responsive
|
||||
* tear-down running container
|
||||
* destroy running container
|
||||
|
||||
```bash
|
||||
export DOCKER_HOST=tcp://<docker-host>:<docker-port>>
|
||||
export TEST_DB_URI=mysql://<your-user>:<your-user-password>@<mysql-host>:<mysql-port>/<functions-db>
|
||||
export FUNCTIONS_API_URL=<functions-api-protocol>://<functions-host>:<functions-port>/<functions-api-version>
|
||||
export OS_AUTH_URL=<identity-api-protocol>://<identity-host>:<identity-port>/<identity-api-version>
|
||||
tox -e docker-full
|
||||
```
|
||||
|
||||
Coverage regression testing
|
||||
---------------------------
|
||||
|
||||
In order to build quality software it is necessary to keep test coverage at its highest point.
|
||||
So, as part of `Tox` testing new check was added - functional test coverage regression.
|
||||
In order to run it use following command:
|
||||
### Coverage regression testing
|
||||
|
||||
$ tox -e py35-functional-regression
|
||||
|
||||
Static code analysis with Bandit
|
||||
================================
|
||||
### Static code analysis with Bandit
|
||||
|
||||
$ tox -e bandit
|
||||
|
|
Loading…
Reference in New Issue