airbyte-integrations/bases/connector-acceptance-test/README.md
This package gathers multiple test suites to assess the sanity of any Airbyte connector. It is shipped as a pytest plugin and relies on pytest to discover, configure and execute tests. Test-specific documentation can be found here.
The acceptance tests are configured via the acceptance-test-config.yml YAML file, which is passed to the plugin via the --acceptance-test-config option.
Note there are MANY ways to do this at this time, but we are working on consolidating them.
Which method you choose to use depends on the context you are in.
Pre-requisites:
GCP_GSM_CREDENTIALS environment variable set to the contents of your GSM service account key file.airbyte-ci)_Note: Install instructions for airbyte-ci are here _
This runs connector acceptance and other tests that run in our CI
airbyte-ci connectors --name=<connector-name> test
Pre-requisites:
To learn how to set up ci_credentials and your GSM Service account see here
# Hook up your GSM service account
export GCP_GSM_CREDENTIALS=`cat <path-to-gsm-service-account-key-file>`
# Install the credentials tool
pipx install airbyte-ci/connectors/ci_credentials/ --force --editable
Retrieve a connectors sandbox secrets
# From the root of the airbyte repo
# Writes the secrets to airbyte-integrations/connectors/source-faker/secrets
VERSION=dev ci_credentials connectors/source-faker write-to-storage
Run install dependencies
# Navigate to our CAT test directory
cd airbyte-integrations/bases/connector-acceptance-test/
# Install dependencies
poetry install
Run the tests
# Run tests against your connector
poetry run pytest -p connector_acceptance_test.plugin --acceptance-test-config=../../connectors/source-faker --pdb
cd into your connector project (e.g. airbyte-integrations/connectors/source-pokeapi)acceptance-test-config.yml according to your need. Please refer to our Connector Acceptance Test Reference if you need details about the available options.airbyte-ci connectors --name=source-pokeapi build)You may want to iterate on the acceptance test project itself: adding new tests, fixing a bug etc. These iterations are more conveniently achieved by remaining in the current directory.
poetry installpoetry run pytest unit_tests (add the --pdb option if you want to enable the debugger on test failure)-k to the above command, e.g. poetry run python -m pytest unit_tests -k 'test_property_can_store_secret'. You can use wildcards * here as well../connector_acceptance_test/conftest.py./connector_acceptance_test/testsacceptance-test-config.yaml structure is defined in ./connector_acceptance_test/config.py./unit_testspoetry run pytest unit_tests, make sure the coverage did not decrease. You can bypass slow tests by using the slow marker: poetry run pytest unit_tests -m "not slow".airbyte-ci connectors --name=source-pokeapi buildpoetry run pytest -p connector_acceptance_test.plugin --acceptance-test-config=../../connectors/source-pokeapidocs/connector-development/testing-connectors/connector-acceptance-tests-reference.md according to your changesairbyte-integrations/bases/connector-acceptance-test/CHANGELOG.md/legacy-publish connector=bases/connector-acceptance-test run-tests=false in a GitHub commentacceptance-test-config.yml to latest configuration formatWe introduced changes in the structure of acceptance-test-config.yml files in version 0.2.12.
The legacy configuration format is still supported but should be deprecated soon.
To migrate a legacy configuration to the latest configuration format please run:
python -m venv .venv # If you don't have a virtualenv already
source ./.venv/bin/activate # If you're not in your virtualenv already
python connector_acceptance_test/tools/strictness_level_migration/config_migration.py ../../connectors/source-to-migrate/acceptance-test-config.yml