From 2451e1970cffb732315ffd95bf0da3d11213f385 Mon Sep 17 00:00:00 2001 From: Jawad <38837406+JDawg287@users.noreply.github.com> Date: Thu, 28 Dec 2023 09:41:38 -0500 Subject: [PATCH] feat: README.md for tests (#51) Signed-off-by: Jawad Tariq --- README.md | 4 ++++ tests/README.md | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 tests/README.md diff --git a/README.md b/README.md index 0eaa868..5b5cc7d 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/tests/README.md b/tests/README.md new file mode 100644 index 0000000..cf7fbed --- /dev/null +++ b/tests/README.md @@ -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/.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`.