An integration testing tool. It leverages an artifact generated by the go-algorand integration tests to ensure all features are exercised.
A python virtual environment is highly encouraged.
cd e2e_tests
# create venv dir, I believe you could specify the version of python here
python3 -m venv venv_dir
# This command depends on your shell
source venv_dir/bin/activate.fish
# Install 'e2elive' and 'e2econduit'
python3 -m pip install .This tests runs the algorand-indexer binary. Depending on what you're doing, you may want to use a different value for --s3-source-net. After the test finishes, a few simple queries are executed.
This command requires a postgres database, you can run one in docker:
docker run --rm -it --name some-postgres -p 5555:5432 -e POSTGRES_PASSWORD=pgpass -e POSTGRES_USER=pguser -e POSTGRES_DB=mydb postgresNote: you will need to restart this container between tests, otherwise the database will already be initialized. Being out of sync with the data directory may cause unexpected behavior and failing tests.
e2elive --connection-string "host=127.0.0.1 port=5555 user=pguser password=pgpass dbname=mydb" --s3-source-net "fafa8862/rel-nightly" --indexer-bin ../cmd/algorand-indexer/algorand-indexer --indexer-port 9890This runs a series of pipeline scenarios with conduit. Each module manages its own resources and may have dependencies. For example the PostgreSQL exporter starts a docker container to initialize a database server.
e2econduit --s3-source-net rel-nightly --conduit-bin ../cmd/conduit/conduitThe e2elive script has a docker configuration available.
make e2eYou may need to set (and export) the CI_E2E_FILENAME environment variable.
export CI_E2E_FILENAME=rel-nightly
make e2eAlternatively, modify e2e_tests/docker/indexer/Dockerfile by swapping out $CI_E2E_FILENAME with the test artifact you want to use. See .circleci/config.yml for the current values used by CI.
All plugins for e2e tests are organized in e2e_tests/src/e2e_conduit/fixtures/ under the proper directory structure. For example, processor plugin fixtures are under e2e_tests/src/e2e_conduit/fixtures/processors/.
To create a new plugin, create a new class under the proper directory which subclasses PluginFixture.
Note that some fixtures have further subclasses, such as ImporterPlugin, which support additional required behavior for those plugin types.
-
nameReturns the name of the plugin--must be equivalent to the name which would be used in the conduit config. -
setup(self, accumulated_config)Setup is run before any of the config data is resolved. It accepts anaccumulated_configwhich is a map containing all of the previously output config values. If your plugin needs to be fed some data, such as the algod directory which was created by the importer, this data can be retrieved from the accumulated_config.
The setup method is responsible for any preparation your plugin needs to do before the pipeline starts.
-
resolve_config_inputThis method sets values onself.config_input, a map which contains all of the Conduit config required to run your plugin. Any values set on this map will be serialized into the data section of your plugin's config when running it in Conduit. -
resolve_config_outputHere, similarly toconfig_input, we set values on theconfig_outputmap. This map is what will be passed between plugins during initialization via theaccumulated_config. If your plugin is creating any resources or initializing any values which other plugins need to know about, they should be set in theconfig_output.
A Scenario is an abstraction for a given instantiation of a Conduit pipeline. In order to run a coduit e2e test, create a scenario in e2e_tests/src/e2e_conduit/scenarios and ensure that it is run in e2e_tests/src/e2e_conduit/e2econduit.py.
For example,
Scenario(
"app_filter_indexer_scenario",
importer=importers.FollowerAlgodImporter(sourcenet),
processors=[
processors.FilterProcessor([
{"any": [
{"tag": "txn.type",
"expression-type": "equal",
"expression": "appl"
}
]}
]),
],
exporter=exporters.PostgresqlExporter(),
)