Skip to content

Commit

Permalink
feat: README.md for tests (#51)
Browse files Browse the repository at this point in the history
Signed-off-by: Jawad Tariq <[email protected]>
  • Loading branch information
JDawg287 authored Dec 28, 2023
1 parent 682539b commit 2451e19
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ docker compose --profile executor-service up -d
- You need to add the `--profile` flag to all commands, e.g. `docker compose --profile ... down`
- **Important**: The Executor Service must run on the `host` network. As detailed in docker's [documentation](https://docs.docker.com/network/host/), the `host` networking driver only works on Linux. This means Mac/Windows users cannot use this flag and must run the Executor Service natively on the host.

## Local integration tests

The integration tests are located in the `./tests` directory (see [README.md](./tests/README.md)).

## Env

A few environment variables are editable from the `.env` file found on the root of this repository.
Expand Down
39 changes: 39 additions & 0 deletions tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
## Description

These tests are designed to be executed locally against a running instance of the Local ERC20 messaging infrastructure (Docker Compose setup). The tests are written as bash scripts, with each test being a separate file that can be run individually. Each test checks if the infrastructure is running and, if not, starts it. The tests then run and report the results. After the tests have been completed, if the infrastructure is started by a particular script, it is stopped in the same way, so there is no need to stop it manually. If local ERC20 messaging infrastructure is started prior to the test script's execution, tests do not start or stop the Docker Compose network.

## Prerequisites

In addition to the prerequisites for the Local ERC20 messaging infrastructure, the following are required to run the tests:

- [Node.js](https://nodejs.org/en/)

## Running the tests

While being in the root of the repository, install the dependencies:

```sh
$ npm install
```

Then, edit the `.env` file to your liking. The default values should work for most cases. Then, source the `.env` file:

```sh
$ source .env
```

To run the tests, execute the tests from the root of the repository:

```sh
$ ./tests/<NAME_OF_TEST>.sh
# e.g. ./tests/test_network_health.sh
```

### Notes

- The tests use TypeScript scripts to interact with the infrastructure. These scripts can be found in the `./scripts` directory. Currently, there are two main scripts available:

- `get-certificate.ts`: Retrieves the certificate from the `ToposCore.sol` contract of a subnet.
- `send-token.ts`: Performs a token transfer transaction using the Topos Messaging Protocol, from one subnet to another, using the `ERC20Messaging.sol` contract.

- The smart contract artifacts are copied from the `topos-sequencer` container to the `./artifacts` directory. These artifacts are then used by the TypeScript scripts to interact with the infrastructure. There is no need to copy them manually, as the tests will take care of that automatically using a helper script, `./scripts/copy_contract_artifacts.sh`.

0 comments on commit 2451e19

Please sign in to comment.