Abstract: This repository contains tests for API. All API tests are currently grouped for these served by hived and these served by hivemind. The goal is to have flat list of the tests and start their subsets separatly by hived and hivemind CI processes.
pip3 install pyresttest
git clone https://github.com/svanoort/pyresttest.git
cd pyresttest
python3 setupt.py build
python3 setup.py install --user
If you are not installing by pip3
make sure that you have installed pyyaml
, future
, pycurl
in your system. Also you will need developer libs for libcurl4-openssl
, libssl
(for Ubuntu libcurl4-openssl-dev
and libssl-dev
)
Runnable with ctest
(TODO)
Node address is defined inside bash script.
a) API tests with equal
comparator (using strict equal on query result and pattern):
./run_api_tests.sh equal
b) API tests with contain
comparator (check if result contain pattern):
./run_api_tests.sh contain
Runnable with ctest
(TODO)
In tests directory we have two bash scripts:
run_api_tests.sh
- for running api tests,run_api_benchmarks.sh
- for running benchmarks
Examples of running tests:
a) API tests in directory full_sync
with equal
comparator (using strict equal on query result and pattern):
./run_api_tests.sh https://api.hive.blog full_sync equal
b) API tests in directory full_sync
with contain
comparator (check if result contain pattern):
./run_api_tests.sh https://api.hive.blog full_sync contain
Examples of running benchmarks:
./run_api_benchmarks.sh https://api.hive.blog
To run tavern test:
- Enter
tavern
directory - Edit
common.yaml
and set variables to desired values - Install tavern/pytest
python3 -m pip install tavern[pytest]
- Run all tests:
export HIVEMIND_ADDRESS=127.0.0.1
export HIVEMIND_PORT=8080
PYTHONPATH=$PYTHONPATH:$(pwd) pytest --workers auto --tests-per-worker auto .
- Run tests from given directory
PYTHONPATH=$PYTHONPATH:$(pwd) pytest --workers auto --tests-per-worker auto <directory_name>
To Run Tavern full sync with specified URL PORT for hivemind node, that checks if API call returns results use:
./scripts/run_tests_full_sync.sh URL PORT
To Run Tavern full sync for pattern tests without checking patterns use:
./scripts/run_full_sync_tests.sh URL PORT ../tavern/
Remarks:
- To increase verbosity use
-vv
option instead of-v
. durations
option gives time measurement for tests, set to0
will show durations of all tests.Number
greater than zero will show onlynumber
slowest tests.-n
option allows to run tests on multiple cores,auto
will use all available cores