Repository navigation
feat(standard-tests): fix the Docker read test, run the basic read checks in it, keep it opt-in - #1231
Conversation
…ts records The Docker read test was skipped everywhere: `--read-from-streams` was registered with default=None, which the fixture turned into "none". Python connectors get no other read in CI until their in-process suite is enabled, so they had no read coverage at all. - `--read-from-streams` and `--read-scenarios` now default to reading; `none` (or `false`) stays the explicit opt-out. - `--read-scenarios=default` falls back to a connector's first read config when none is named config/valid_config/default, so it can no longer skip every read of a connector. `--read-scenarios=none` and a scenario list no longer raise ValueError for the configs they leave out; those configs are skipped. - The Docker read records get the checks of test_basic_read (assert_read_records): records per stream for basic_read configs, schema validation with the validate_schema opt-out, rejected at test_strictness_level: high. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…rking directory The platform runs a connector with its working directory on a writable volume. The Docker tests ran in the image's WORKDIR, which the image's non-root user cannot write to, so the Docker read of connectors that download a bulk export to the working directory (source-shopify, source-salesforce) failed with PermissionError in the test only. Run check, discover and read with a tmpfs working directory at /source, the platform's source directory. Also add the migration note for the Docker read test. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…er tests in the migration guide Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… matrix The FAST standard-test steps collect the Docker tests too, so with the read on by default the matrix read every connector twice. The `image test` step keeps the read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…of the Docker read CDK 7.36.0 and earlier map only `false` to the opt-out: they read `none` as a stream name and run the Docker discover plus an empty read. The FAST steps of the connector test matrix now pass `false`, which skips the read on every CDK version, and the migration guide and docstrings recommend `false` for CI files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…st Python connectors source-s3 and source-hardcoded-records already read through their own integration tests, so the migration note should not claim the Docker read is the first read for every Python connector (review round 2, finding 1). 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/enable-docker-read-test#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/enable-docker-read-testPR Slash CommandsAirbyte Maintainers can execute the following slash commands on your PR:
|
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>
…ker-read-test # Conflicts: # cdk-migrations.md
…s test_basic_read reads Connector CI now reads every connector whose in-process standard tests run through `test_basic_read` (airbytehq/airbyte-internal-issues#17133), so a Docker read on by default would read each of them twice. `--read-from-streams` defaults to `false` again; `default` turns the read on. Connector CI turns it on only for a Python source whose pinned CDK predates the in-process suite (airbytehq/airbyte-internal-issues#17137). When it runs, the Docker read reads the same streams as `test_basic_read`: the `suggestedStreams` narrowing is removed, and `all` and `suggested` are kept as aliases of `default`. The CDK's connector matrix turns the read on in its `image test` step, so the read path keeps running in CI, and the FAST steps no longer need `--read-from-streams=false`.
…ker-read-test # Conflicts: # cdk-migrations.md
…ecks in the Docker read The Docker read now checks a basic_read config the way test_basic_read does since 7.42.0: usable primary keys, a per-stream state message with sourceStats for every stream read, and the StreamStatusWarning. The validate_primary_keys_data_type and validate_state_messages opt-outs apply to it too.
…y option values, correct the migration notes - `--read-scenarios=default` adds the first `basic_read` config when none of the configs it picks by name is one, and falls back to the first `basic_read` config before the first read config, so the Docker read gets the `basic_read` checks (source-intercom's layout skipped them). - `--read-from-streams` and `--read-scenarios` values that name nothing (`--read-from-streams=`, `,`) are usage errors instead of silently skipping every read. A bool option value goes through `str()` instead of its own branch. - cdk-migrations.md and docstrings: the `empty_streams` crash was fixed in 7.36.0, not here; every release through 7.42.0 reads `none` as a stream name; the platform uses `/source` for a source's `read` and `/config` for `check` and `discover`; the `/source` change reaches every connector's Docker `check` and `discover`; the tmpfs uses memory, and why it is not a bind mount; connector CI policy is stated as intent. - Tests: the Docker read unit tests fail when the read skips instead of running; new cases for the default config choice, empty option values, and the working directory of `check` and `discover`. The Docker `check` tests answer `spec`, so they run instead of skipping on the secret leak check, and their stale `raise_if_errors` assertion is updated. Shared stubs move to `unit_tests/test/standard_test_stubs.py`.
Daryna Ishchenko (darynaishchenko)
left a comment
There was a problem hiding this comment.
Approve. I didn't find a breaking change. The Docker read test was already off by default (--read-from-streams was registered with default=None, which the fixture mapped to none) and still is. When it's on, it now makes the same assert_read_records and stream-status checks as test_basic_read. The only change every connector gets is the /source working directory for Docker check and discover, and that matches the platform (ReplicationContainerFactory uses withWorkingDir(SOURCE_DIR), ConnectorPodFactory uses withWorkingDir(configDir)).
Verified:
- The 216 tests in the touched test files pass locally.
- I broke the code on purpose 35 ways, and 31 of those fail a test.
- The matrix ran the Docker read with the tmpfs args, and it passed on shopify, intercom, pokeapi and hardcoded-records.
destination-motherduckis red at the secret fetch, as on most recent PRs.
The two 🟠 comments below aren't blocking. Rollout: #88939's fleet dry run on the old-CDK images is the real gate, because those images now face the 7.42.0 state and primary-key checks.
…that matches nothing A misspelled name in `--read-scenarios` or `--read-from-streams` skipped every Docker read, and the run passed. A `--read-scenarios` name that is not one of the connector's read configs, or a `--read-from-streams` name that `discover` does not report for the config (matched exactly, case included), now fails the test. A config whose catalog or `empty_streams` leaves out every listed, discovered stream is still skipped. The unit tests that call a standard test method directly now go through a shared `run_without_skip` guard in `standard_test_stubs.py`, so a skip fails them instead of skipping them, and pass `--read-from-streams=default` rather than its `all` alias.
Part of airbytehq/airbyte-internal-issues#17137 (P1.4 "Docker read test", under airbytehq/airbyte-internal-issues#17129). Companion monorepo PR: airbytehq/airbyte#88939.
What
test_docker_image_build_and_readrunsreadinside the connector image. It is skipped by default, and when it was turned on:suggestedStreams, when the connector declared them.--read-scenariosskipped every read of a connector whose configs had other names.(The
empty_streamscrash that #17137 also describes was fixed in 7.36.0 by #1142.)Since airbytehq/airbyte-internal-issues#17133, connector CI reads every connector whose in-process tests run, through
test_basic_read. A Docker read on by default would read each of them a second time. The decision is recorded in #17137. So the read stays opt-in, and this PR fixes it:--read-from-streamsdefaults tofalse. Theaddoptiondefault, the fixture fallback and the docstring agree.defaultturns the read on.true,allandsuggestedare aliases ofdefault, so existing commands still run. A comma list of stream names narrows the read.test_basic_read. The read covers the config'sconfigured_catalog_path, or every discovered stream, minusempty_streams(get_read_streams, shared withtest_basic_read). The connector'ssuggestedStreamsno longer narrow it: they are what the UI preselects, not a test selection.test_basic_read. A config underbasic_readgoes through the sameassert_read_recordscall, with the same arguments:validate_schema: falseopts out, and is rejected attest_strictness_level: highbefore any Docker command.validate_primary_keys_data_type: falseopts out.sourceStats(feat(standard-tests): check primary keys, state messages and error traces in read tests, and report stream statuses #1230).validate_state_messages: falseopts out.StreamStatusWarning(feat(standard-tests): check primary keys, state messages and error traces in read tests, and report stream statuses #1230), not a failure.full_refreshmust return some records./sourceworking directory (an in-memorytmpfs) for the Dockercheck,discoverandread. The platform uses/sourcefor a source'sread, and/configforcheckanddiscover; any writable directory outside the image serves those tests. A Python connector image'sWORKDIRis not writable by theairbyteuser, sosource-shopifyandsource-salesforcefailed with aPermissionErroron bulk-export temp files that a sync never hits.--read-scenariosfixes.config,valid_configordefault, and otherwise the firstbasic_readconfig (or the first read config). Before, 12 source connectors with other config names skipped every read.basic_read, the default also reads the firstbasic_readconfig, so the read gets thebasic_readchecks. source-intercom, whoseconfigis only underfull_refresh, skipped them.noneand lists skip instead of raising aValueError.--read-from-streams=,--read-scenarios=,) is a usage error, so an empty CI variable cannot turn the read off with a green run.--read-scenariosname that is not one of the connector's read configs, or a--read-from-streamsname thatdiscoverdoes not report for the config. Stream names match exactly, case included. A config whose catalog orempty_streamsleaves out every listed, discovered stream is still skipped.image teststep (PYTEST_ADDOPTS: --read-from-streams=default), so the read path keeps running in CI.How
--read-from-streams(whether to read, which streams)false: skippeddefault(alsotrue,all,suggested): the streamstest_basic_readreads; a comma list of stream names narrows them (exact names; one thatdiscoverdoes not report fails);nonealso skips (CDK 7.42.0 and earlier readnoneas a stream name, so usefalse); an empty value is an error--read-scenarios(which configs, once the read is on)default: configs namedconfig,valid_configordefault, plus the firstbasic_readconfig when none of those is one; else the firstbasic_read(or read) config expected to succeedall, a comma list of config names (one that is not a read config fails),none(skip)The test calls
assert_read_records,assert_schema_validation_opt_out_allowedandfind_stream_status_problemsfrom_read_assertions.py, astest_basic_readdoes, so a check added there reaches both reads through the same call.Files
airbyte_cdk/test/standard_tests/pytest_hooks.py:falsedefault for--read-from-streams, fixture parsing, docstrings.airbyte_cdk/test/standard_tests/docker_base.py: default scenario selection, stream selection withoutsuggestedStreams, record, primary key, state and stream status checks,/sourceworking directory forcheck,discoverandread.unit_tests/test/test_docker_read.py(new).unit_tests/test/standard_test_stubs.py(new): the scenario, suite and Docker stubs thattest_scenario_sections.pyandtest_docker_read.pyshare, moved out oftest_scenario_sections.py. The read stubs emit state messages.run_without_skipfails a unit test whose directly called standard test method skips; both files use it for every call that must run.unit_tests/test/test_check_assertions.py: the Dockerchecktests stubspec, so they run instead of skipping on the secret leak check (they all skipped since feat(standard-tests): lintairbyte_secretmarking and secret leaks #1219), and assert the working directory..github/workflows/connector-tests.yml: theimage teststep turns the Docker read on.cdk-migrations.md: new "Upgrading to the next minor release (unreleased)" section.main's unreleased section for feat(standard-tests): check primary keys, state messages and error traces in read tests, and report stream statuses #1230 is renamed to "Upgrading to 7.42.0", the release that shipped it.Cost of the read, when it runs
Measured on the earlier revision of this branch, which narrowed the read to
suggestedStreams, against the published images of airbytehq/airbytemaster:suggestedStreams, so it read everyactivities_*export.This is the cost a default-on read would have added to every connector that already reads in process, and why the read stays opt-in. Dropping the
suggestedStreamsnarrowing changes the read only for connectors that declare them. Of the Python sources with a CDK too old for the in-process tests, which are the ones airbytehq/airbyte#88939 will read, only source-mixpanel does.Rollout
checkanddiscovermove to/sourcefor every connector (item 4).--read-from-streams=defaulton a released CLI would read onlysuggestedStreamswhere declared, check no records, and fail on a Python connector that writes to its working directory. Its fleet dry run of the old-CDK Python sources runs against this release.test_basic_readchecks.Test plan
unit_tests/test: 1026 passed, 0 skipped. The 9 earlier skips were the Dockerchecktests, which now run.test_docker_read.pyandtest_scenario_sections.py), dropping the unknown-config or unknown-stream check, dropping thebasic_readaddition, and dropping the working-directory arguments fromcheck,discoverorreadeach fail tests.acceptance-test-config.yml. Not re-run after the default flip, since that run used explicit option values.Test Connectorsmatrix on this PR green, with the Docker read on inimage test🤖 Generated with Claude Code