~zinigor/cardano-node/trunk

« back to all changes in this revision

Viewing changes to doc/getting-started/running-chairman-tests.md

  • Committer: Igor Zinovyev
  • Date: 2021-08-13 19:12:27 UTC
  • Revision ID: zinigor@gmail.com-20210813191227-stlnsj3mc5ypwn0c
Tags: upstream-1.27.0
ImportĀ upstreamĀ versionĀ 1.27.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
## Purpose
 
2
 
 
3
The chairman tests are a set of tests run only in CI to ensure that a static
 
4
set of nodes are able to join a cluster and make progress forging new blocks.
 
5
 
 
6
These tests are paramterised over operating systems:
 
7
 
 
8
* Linux
 
9
* MacOS
 
10
* Windows
 
11
 
 
12
and various run-modes:
 
13
 
 
14
* Byron only
 
15
* Shelley only
 
16
* Byron-Shelley
 
17
 
 
18
### Prerequisites
 
19
You must already be able to build everything in the `cardano-node` repository
 
20
using `cabal` (not `nix`).
 
21
 
 
22
See [Installing a node from source](install.md).
 
23
 
 
24
## Running the chairman test
 
25
The chairman test will run some testnets and perform some basic tests to ensure they
 
26
are working.
 
27
 
 
28
Those basic tests may differ depending on the testnet that is being tested, but may
 
29
include for example:
 
30
 
 
31
Asserting that each node:
 
32
 
 
33
* Opens the correct port
 
34
* Creates a socket file (or OS-specific equivalent) at the expected location
 
35
 
 
36
To see what assertions are made, please see the source code of the testnet you are
 
37
interested in.  These can be found in `cardano-node-chairman/src`.
 
38
 
 
39
To run the chairman tests, first build the necessary executables:
 
40
 
 
41
```bash
 
42
$ cabal build cardano-cli cardano-node cardano-node-chairman cardano-testnet
 
43
```
 
44
 
 
45
Then run the tests:
 
46
 
 
47
```bash
 
48
cabal test cardano-node-chairman
 
49
```
 
50
 
 
51
## Design
 
52
 
 
53
The testnet launcher and chairman test use common code under the `cardano-node-chairman/src` directory
 
54
to launch any one of multiple testnets.
 
55
 
 
56
This section will discuss the overall structure of this common design.
 
57
 
 
58
The testnet infrastructure will create a workspace directory with a random suffix to ensure that if multiple
 
59
testnets are launched, they will not interfere with each other via the filesystem.  All the configuration files,
 
60
logging output, and socket files will be written to to files somewhere in the workspace.  The
 
61
actual workspace location will be logged in the test output.
 
62
 
 
63
The nodes themselves (and the chairman executable in the case of the chairman tests) will be executed from
 
64
the parent directory of the workspace directory.  This is to work around operating system limitations such
 
65
as filename restrictions whilst still ensuring that the names of socket files (or in the case of Windows,
 
66
named pipes) remain unique.
 
67
 
 
68
The infrastructure uses hedgehog to provide annotations as an alternative to logging.  This allows the configuration
 
69
and logging to be printed close to the source code that generated it, making it easy to follow the testnet
 
70
set up and diagnose any potential issues.
 
71
 
 
72
A downside to doing it this way is all the output is collected whilst the testnet is being brought up, but
 
73
no output will be printed until the testnet is fully launched or a failure occurs.
 
74
 
 
75
For further details information see [Testing Cardano with Hedgehog](https://youtu.be/ZAN18xZGsSY), keeping in
 
76
mind the following correction, which is when the chairman test is run, one chairman process is created for the
 
77
entire testnet and connects to each and every node.