status-go/integration-tests
Igor Sirotin edffaae9f3
feat_: integration tests coverage
2024-09-05 22:11:22 +01:00
..
schemas test(rpc)_: wakuext add contact, wakuext_peers 2024-08-22 17:12:00 +02:00
tests test(rpc)_: wakuext add contact, wakuext_peers 2024-08-22 17:12:00 +02:00
Dockerfile test(integration)_: separate anvil from tests 2024-06-18 17:17:23 +02:00
Dockerfile.tests-rpc feat(ci)_: add Jenkinsfile, Dockerfile for RPC tests 2024-07-04 16:14:02 +02:00
README.MD fix(integration-tests)_: add missing schema 2024-07-04 16:14:02 +02:00
config.json test(rpc)_: wakuext add contact, wakuext_peers 2024-08-22 17:12:00 +02:00
conftest.py test(rpc)_: wakuext add contact, wakuext_peers 2024-08-22 17:12:00 +02:00
docker-compose.anvil.yml fix(tests-rpc)_: Remove port bind 2024-07-23 11:03:31 +02:00
docker-compose.test.status-go.yml feat_: integration tests coverage 2024-09-05 22:11:22 +01:00
entrypoint.sh test(integration)_: separate anvil from tests 2024-06-18 17:17:23 +02:00
pytest.ini test(rpc)_: wakuext add contact, wakuext_peers 2024-08-22 17:12:00 +02:00
requirements.txt
schema_builder.py

README.MD

Overview

Integration tests for status-go

Table of Contents

How to Install

  • Install Docker and Docker Compose
  • Install Python 3.10.14
  • In integration-tests directory, run pip install -r requirements.txt
  • Optional (for test development): Use Python virtual environment for better dependency management. You can follow the guide here:

How to Run

Running dev RPC (anvil with contracts)

  • In integration-tests run docker compose -f docker-compose.anvil.yml up --remove-orphans --build, as result:
    • an anvil container with ChainID 31337 exposed on 0.0.0.0:8545 will start running
    • Status-im contracts will be deployed to the network

Run tests

  • In integration-tests run docker compose -f docker-compose.anvil.yml -f docker-compose.test.status-go.yml up --build --remove-orphans, as result:
    • a container with status-go as daemon will be created with APIModules exposed on 0.0.0.0:3333
    • status-go will use anvil as RPCURL with ChainID 31337
    • all Status-im contracts will be deployed to the network
  • In integration-tests/tests directory run pytest -m wallet

Implementation details

  • Integration tests are implemented in integration-tests/tests based on pytest
  • Every test has two types of verifications:
    • verify_is_valid_json_rpc_response() checks for status code 200, non-empty response, JSON-RPC structure, presence of the result field, and expected ID.
    • jsonschema.validate() is used to check that the response contains expected data, including required fields and types. Schemas are stored in /schemas/wallet_MethodName
    • New schemas can be generated using integration-tests/schema_builder.py by passing a response to the CustomSchemaBuilder(schema_name).create_schema(response.json()) method, should be used only on test creation phase, please search how to create schema: to see an example in a test