Skip to content

Commit 919f725

Browse files
committed
qa: update the README to make Postgre optional, and some fixups
1 parent 2af2b83 commit 919f725

File tree

1 file changed

+28
-19
lines changed

1 file changed

+28
-19
lines changed

tests/README.md

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,7 @@ variables: `POSTGRES_USER`, `POSTGRES_PASS` and optionally `POSTGRES_HOST` (if n
3939
`localhost`). The framework will take care of creating a database for each process
4040
launched, and to drop it at teardown time.
4141

42-
#### Without the servers
43-
44-
You can write and run tests that don't need the servers. By default, if no `POSTGRES_*`
45-
environment variables are passed, the framework will skip the tests that depends on
46-
servers:
47-
48-
```
49-
# Adapt `-n`, `-v`, `timeout` and other environment variables to your needs
50-
pytest tests/ -vvv -n4 --ignore tests/servers/
51-
```
52-
53-
#### With the servers
42+
#### Compiling the servers
5443

5544
For spinning up the servers, the framework will need access to the binaries. Therefore you
5645
must `init` the submodules (if you did not `clone` with `--recursive`) and compile the
@@ -59,21 +48,41 @@ servers code:
5948
# From the root of the repository
6049
git submodule update --init --recursive
6150
cd tests/servers
62-
cd coordinatord && cargo build && cd ..
6351
cd cosignerd && cargo build && cd ..
6452
cd miradord && cargo build && cd ..
6553
```
6654

67-
When you need a new version of the servers, you can update the submodules:
55+
When you need a new version of the servers, you can update the submodules. You can use a
56+
script from `contrib/` that updates the servers and recompiles them:
6857
```
6958
# From the root of the repository
70-
cd tests/servers
71-
git submodule update --remote --recursive
59+
./contrib/recompile_tests_servers.sh
60+
```
61+
62+
#### Using the real Coordinator
63+
64+
By default, the functional tests will use a dummy in-RAM coordinator (see
65+
[`test_framework/coordinatord.py`](test_framework/coordinatord.py).
66+
67+
The tests can be ran using `coordinatord`, and some require its use.
68+
69+
In order to use it you'll first need to compile it:
70+
```
71+
# From the root of the repository
72+
git submodule update --init --recursive
73+
cd tests/servers/coordinatord && cargo build
74+
cd ../../../
7275
```
7376

74-
To run the server-requiring tests, pass the postgres credentials to the framework:
77+
And then you'll need to set a Postgre backend up. The easiest way to do so is by using Docker:
7578
```
76-
POSTGRES_USER="test" POSTGRES_PASS="test" TEST_DEBUG=1 pytest -vvv -n8 --timeout=1800
79+
docker run --rm -d -p 5432:5432 --name postgres-coordinatord -e POSTGRES_PASSWORD=revaultd_tests -e POSTGRES_USER=revaultd_tests -e POSTGRES_DB=coordinator_db postgres:alpine
80+
```
81+
82+
To run the tests with, pass the postgres credentials to the framework:
83+
```
84+
# From the root of the repository
85+
POSTGRES_USER=revaultd_tests POSTGRES_PASS=revaultd_tests pytest -vvv --ignore tests/servers -n 10
7786
```
7887

7988

@@ -89,7 +98,7 @@ You can override the config at runtime with the `--log-cli-level` option:
8998
POSTGRES_USER=test POSTGRES_PASS=test pytest -vvv --log-cli-level=DEBUG -k test_getrevocationtxs
9099
```
91100

92-
Note that we log each daemon log, and we start them with `log_level = "trace"`.
101+
Note that we log each daemon log if `VERBOSE=1`, and we start them with `log_level = "debug"`.
93102

94103
#### Profiling
95104

0 commit comments

Comments
 (0)