Repository navigation
feat(standard-tests): build sources that require catalog, config and state - #1232
Anatolii Yatsuk (tolik0) wants to merge 2 commits into
Conversation
…state The in-process Standard Tests called the connector class with no arguments. Python sources built on YamlDeclarativeSource, FileBasedSource or ConcurrentSourceAdapter require catalog, config and state, so every in-process test of those connectors failed with a TypeError before reaching the connector. That blocks running the suite in connector CI (airbyte-internal-issues #17133) for asana, freshcaller, google-ads, google-drive, microsoft-sharepoint, salesforce and sftp-bulk. create_connector() now inspects the signature and passes config from the scenario (an empty dict when there is none) and None for catalog and state, matching what run.py passes when it launches without them. Any other required argument raises a TypeError naming it, since the suite cannot guess it. An optional config also receives the scenario's config when there is one, as run.py passes --config. When the class accepts catalog, config or state, required or optional, its read is done by a source built from the read command's catalog, config and state, as run.py builds it. A file-based source takes its stream schemas from the catalog it is built with, so a source built without one fails every read with a missing json_schema error. A declarative Python source with an optional config (source-facebook-pages) evaluates the config in its components when it is built, so a source built without one sends requests with empty config values. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
👋 Greetings, Airbyte Team Member!Here are some helpful tips and reminders for your convenience. 💡 Show Tips and TricksTesting This CDK VersionYou can test this version of the CDK using the following: # Run the CLI from this branch:
uvx 'git+https://github.com/airbytehq/airbyte-python-cdk.git@tolik0/cdk/python-connector-test-support#egg=airbyte-python-cdk[dev]' --help
# Update a connector to use the CDK from this branch ref:
cd airbyte-integrations/connectors/source-example
poe use-cdk-branch tolik0/cdk/python-connector-test-supportPR Slash CommandsAirbyte Maintainers can execute the following slash commands on your PR:
|
| AirbyteStateMessage, | ||
| ConfiguredAirbyteCatalog, | ||
| ) | ||
| from airbyte_cdk.sources.source import Source |
PyTest Results (Fast)290 tests - 5 548 280 ✅ - 5 527 1m 7s ⏱️ - 7m 2s For more details on these failures, see this check. Results for commit 73e0932. ± Comparison against base commit 8b721cd. This pull request removes 5548 tests.♻️ This comment has been updated with latest results. |
PyTest Results (Full)5 852 tests +11 5 820 ✅ +10 17m 1s ⏱️ +20s For more details on these failures, see this check. Results for commit 73e0932. ± Comparison against base commit 8b721cd. ♻️ This comment has been updated with latest results. |
Resolve the cdk-migrations.md conflict with #1226: its section ships as 7.39.0, so it is renamed "Upgrading to 7.39.0" below this change's "(unreleased)" section. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
The in-process Standard Tests (
SourceTestSuiteBase, used byairbyte-cdk connector testand bycreate_connector_test_suite()) now build Python sources the way theirrun.pydoes:create_connector()inspects the constructor (or factory) signature.catalog,configorstate, the suite passes the scenario's config (an empty dict when there is none) andNoneforcatalogandstate, asrun.pypasses them when it launches without a catalog or state.configalso gets the scenario's config, when the scenario has one, sincerun.pyalways passes--config.TypeErrorthat names it and says how to work around it.catalog,configorstate(required or optional), itsreadis done by a source built from thereadcommand's catalog, config and state, again asrun.pybuilds it.Why
The suite called the connector class with no arguments. Python sources built on
YamlDeclarativeSource,FileBasedSourceorConcurrentSourceAdapterrequirecatalog,configandstate, so every in-process test of those connectors failed with aTypeErrorbefore reaching the connector. This blocks running the suite in connector CI (airbytehq/airbyte-internal-issues#17133) for source-asana, source-freshcaller, source-google-ads, source-google-drive, source-microsoft-sharepoint, source-salesforce and source-sftp-bulk.Two kinds of source also need to be built with the command's own arguments:
json_schemaerror.config(source-facebook-pages) evaluates the config in its components when it is built. Built without one,checkandreadsend requests with empty config values.Verification
poetry run pytest unit_tests/test/ -p no:cacheprovider: 795 passed, 9 skipped. The new unit tests cover:readcommand;read.ruff format --check,ruff checkandmypy airbyte_cdk/testare clean.check, on its test credentials, which are known to be invalid (it already failsairbyte-cdk image test).Related PRs
This PR is part of airbytehq/airbyte-internal-issues#17133. It waits for no monorepo PR, and none of them waits for it: the new connector CI step runs each connector's pinned CDK, and the monorepo suite files build these sources themselves until a connector pins a release with this change.
integration_tests/standard_tests.pysuites for 14 sources. The 7 sources of its group 1 and source-facebook-pages (group 3) can delete theirs once they pin a release with this PR; the file-based sources of group 2 keep theirs, sinceFileBasedSourcealso requires a stream reader and a spec class.Migration
cdk-migrations.mdgets a new section under "Upgrading to the next minor release (unreleased)". No action is needed for most connectors. Connectors that overridecreate_connector()only to passcatalog,configandstatecan drop the override once they pin this release. The airbyte monorepo adds such overrides asintegration_tests/standard_tests.py(airbytehq/airbyte#88940).🤖 Generated with Claude Code