Skip to content

Latest commit

 

History

History
25 lines (18 loc) · 2.41 KB

README.md

File metadata and controls

25 lines (18 loc) · 2.41 KB

Indexer E2E tests

make e2e runs tests with input generated by go-algorand e2e_subs tests. As of writing make e2e is the only automated validation of indexer's consumption of algod output.

The process for running e2e tests can be done in one of two ways:

  • Run make e2e
  • Run the following manual process

Since make e2e spins up a new docker container for each invocation, the manual process described below can be faster for developers since it utilizes the executables that are built locally on the machine.

Once the developer has built the code they want to test, perform the following:

  1. Execute docker run -it --rm --name some-postgres -p 5432:5432 -e POSTGRES_HOST_AUTH_METHOD=trust -e POSTGRES_USER=$USER -e POSTGRES_DB=indexer_db_e2e postgres to launch a local postgres database
  2. Setup a temporary virtual environment: python3 -m venv /tmp/venv
  3. Install the requirements into the virtual environment: source /tmp/venv/bin/activate && pip install -r misc/requirements.txt
  4. Execute /tmp/venv/bin/python3 misc/e2elive.py --connection-string "host=localhost port=5432 user=$USER dbname=indexer_db_e2e sslmode=disable" to run the tests using local executables
  5. Tests have succeeded if the output contains indexer e2etest OK
  6. If a test fails or you wish to modify your code, build it then execute step 4 again to see the output.

e2elive.py prerequisites

e2elive.py requires access to algorand-indexer and goal binaries. If you receive an error related to the algorand-indexer binary then you need to build the indexer from scratch by running make in the root of the indexer repository. This will insert a binary in the cmd/algorand-indexer directory, where e2elive.py expects it by default.

If the error is related to goal then the most likely cause is that the goal binary hasn't been installed as a package in the GOPATH system variable. Navigate to the go-algorand repository directory and run make install. If the error persists then run export GOPATH=$(go env GOPATH) followed by export PATH=$PATH:$GOPATH/bin in order to verify that the binary is accessible.

The test data used in make e2e during CI build is pinned to a version of rel/nightly artifact defined by CI_E2E_FILENAME in .circleci/config.yml. make update-submodule updates the submodule and CI_E2E_FILENAME should be updated accordingly.