* SAT: do not treat spec fields with const values as the ones that can hold secrets * sat: upd changelog
Source Acceptance Tests
This package gathers multiple test suites to assess the sanity of any Airbyte source 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).
Running the acceptance tests on a source connector:
cdinto your connector project (e.g.airbyte-integrations/connectors/source-pokeapi)- Edit
acceptance-test-config.ymlaccording to your need. Please refer to our Source Acceptance Test Reference if you need details about the available options. - Build the connector docker image ( e.g.:
docker build . -t airbyte/source-pokeapi:dev) - Use one of the following ways to run tests (from your connector project directory)
Using python
python -m pytest integration_tests -p integration_tests.acceptance
Note: this will assume that docker image for connector is already built
Using Gradle
./gradlew :airbyte-integrations:connectors:source-<name>:sourceAcceptanceTest
Note: this way will also build docker image for the connector
Using Bash
./acceptance-test-docker.sh
Note: this will use the latest docker image for source-acceptance-test and will also build docker image for the connector
When does SAT run?
- When running local acceptance tests on connector:
- When running
sourceAcceptanceTestgradletask - When running or
./acceptance-test-docker.shin a connector project
- When running
- When running
/testcommand on a GitHub pull request. - When running
/publishcommand on a GitHub pull request. - When running
integration-testGitHub action that is creating the connector builds summary.
Developing on the SAT
You may want to iterate on the SAT project: adding new tests, fixing a bug etc. These iterations are more conveniently achieved by remaining in the current directory.
- Create a
virtualenv:python -m venv .venv - Activate the
virtualenv:source ./.venv/bin/activate - Install requirements:
pip install -e . - Run the unit tests on SAT:
python -m pytest unit_tests(add the--pdboption if you want to enable the debugger on test failure) - Make the changes you want:
- Global pytest fixtures are defined in
./source_acceptance_test/conftest.py - Existing test modules are defined in
./source_acceptance_test/tests acceptance-test-config.yamlstructure is defined in./source_acceptance_test/config.py
- Global pytest fixtures are defined in
- Unit test your changes by adding tests to
./unit_tests - Run the unit tests on SAT again:
python -m pytest unit_tests, make sure the coverage did not decrease. You can bypass slow tests by using theslowmarker:python -m pytest unit_tests -m "not slow". - Manually test the changes you made by running SAT on a specific connector. e.g.
python -m pytest -p source_acceptance_test.plugin --acceptance-test-config=../../connectors/source-pokeapi - Make sure you updated
docs/connector-development/testing-connectors/source-acceptance-tests-reference.mdaccording to your changes - Bump the SAT version in
airbyte-integrations/bases/source-acceptance-test/Dockerfile - Update the project changelog
airbyte-integrations/bases/source-acceptance-test/CHANGELOG.md - Open a PR on our GitHub repository
- Run the unit test on the CI by running
/test connector=bases/source-acceptance-testin a GitHub comment - Publish the new SAT version if your PR is approved by running
/publish connector=bases/source-acceptance-test auto-bump-version=falsein a GitHub comment - Merge your PR
Migrating acceptance-test-config.yml to latest configuration format
We 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 source_acceptance_test/tools/strictness_level_migration/config_migration.py ../../connectors/source-to-migrate/acceptance-test-config.yml