1. Create directory in which you will store your testing environment, for simplicity I'll use `/tmp`
2. In this solution we will be using `hived` docker image as a source of block data for hivemind
3. If you don't like docker "because of reasons" you can use [this](https://gitlab.syncad.com/hive/hivemind/-/wikis/Testing-hivemind#preparing-hived-node) howto instead
## Preparing `hived` node
1. Clone latest sources of the `hivemind`
```shell
$ cd /tmp #note this should be your testing environment directory
$ hive server --steemd-url'{"default":"http://127.0.0.1:8090"}'--database-url postgresql://hive@localhost:5432/hive
```
4. Leave `hivemind` server working
# Running tavern tests
Tavern tests are located in `<hivemind-src>/tests/tests_api/hivemind/tavern` directory. It is a set of `yaml` files with accompanying `pat.json` files. Test is defined in `yaml` file, its expected result is defined in `pat.json` file. Call with parameters defined in `yaml` file is made to `hivemind` instance, and the result is compared with `pat.json`. Test fails when differences between pattern and response is detected. In that case an `out.json` file is created for manual inspection by the user.
To run `tavern` tests enter `hivemind` source directory and run tests using `run_tests.sh` script
```shell
$ cd /tmp/hivemind
$ scripts/run_tests.sh 127.0.0.1 8080
```
Where `127.0.0.1` is hivemind instance IP, and `8080` is hivemind instance port.
# Running benchmarks
Benchmarks are based on requests defined in tavern test `yaml` files. Each request is called `n` times, execution times are gathered and then basend on that data the mean/min/max values are calculated. The benchmak test produce `tavern_benchmarks_report.html` with summary. In this summary calls with execution time greater than 1s are marked in red.
To run benchmarks enter `hivemind` source directory and run benchmarks using `ci_start_api_benchmarks.sh` script