test: assert reported check status in both standard-test paths - #1142
test: assert reported check status in both standard-test paths#1142devin-ai-integration[bot] wants to merge 1 commit into
check status in both standard-test paths#1142Conversation
Co-Authored-By: bot_apk <apk@cognition.ai>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
👋 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@devin/1788275534-shared-check-assertion#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 devin/1788275534-shared-check-assertionPR Slash CommandsAirbyte Maintainers can execute the following slash commands on your PR:
|
|
CI note on the That job is already red on On this PR the same job fails 4 tests: the same 2 plus the two in-process |
PyTest Results (Fast)4 372 tests +9 4 360 ✅ +9 9m 34s ⏱️ -13s Results for commit 23cb5b7. ± Comparison against base commit 64bdfc9. This pull request removes 11 and adds 20 tests. Note that renamed tests count towards both. |
There was a problem hiding this comment.
Pull request overview
Unifies and tightens how Standard Tests assert the outcome of the check command so the in-process and Docker-based paths enforce the same expectations and don’t drift.
Changes:
- Extracts shared
checkassertion logic intoairbyte_cdk/test/standard_tests/_assertions.py::assert_check_outcome. - Updates both Docker (
docker_base) and in-process (_job_runner.run_test_job) paths to use the shared assertion. - Replaces/updates unit tests to cover the full outcome matrix (including end-to-end via
run_test_job).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| unit_tests/test/test_docker_base_check_outcome.py | Removes old unit tests tied to the Docker-only assertion helper. |
| unit_tests/test/test_check_assertions.py | Adds comprehensive unit tests for shared check assertion and in-process coverage. |
| airbyte_cdk/test/standard_tests/docker_base.py | Switches Docker check path to call the shared assert_check_outcome. |
| airbyte_cdk/test/standard_tests/_job_runner.py | Switches in-process check path to call the shared assert_check_outcome. |
| airbyte_cdk/test/standard_tests/_assertions.py | Introduces shared assertion implementation for check outcome validation. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
PyTest Results (Full)4 375 tests 4 363 ✅ 12m 8s ⏱️ Results for commit 23cb5b7. |
Summary
The Standard Tests had two ways for a failing
checkto pass a test, because the in-process and Docker paths asserted different things:run_test_job(in-process) asserted exactly oneCONNECTION_STATUSmessage, and only assertedStatus.FAILEDinside theexpect_exception()branch. A connector whosecheckgracefully returnsAirbyteConnectionStatus(status=FAILED)(exit code 0, no trace error) passed a scenario declaringstatus: succeed._assert_check_outcome(Docker) assertedSUCCEEDEDonly underexpect_success(), so anALLOW_ANYscenario (no declaredstatus) accepted a failingcheckin both paths.This extracts the assertion into
airbyte_cdk/test/standard_tests/_assertions.py::assert_check_outcomeand calls it from both paths, so they cannot drift again:The assertion is also tightened, in the two ways the issue asks for:
ALLOW_ANY(no declaredstatus) now requiresSUCCEEDED— matching the default of CAT'sConnectionTestConfig.status(succeed). Blast radius is called out below.EXPECT_EXCEPTIONnow requires a reportedFAILEDstatus instead of accepting the absence of anyCONNECTION_STATUSmessage (closes gap 2 of airbytehq/airbyte-internal-issues#16212 as originally specified).Blast radius of the
ALLOW_ANYdecisionStatusless configs (configs that never declare a
statusin any section ofacceptance-test-config.yml) now have theircheckrequired to succeed.DockerConnectorTestSuite._dedup_scenariosalready carries an explicitly declaredstatusacross sections, so only configs that declare no status anywhere are affected. Scanned atairbytehq/airbyte@587f1f4f706:source-s3secrets/parquet_dataset_config.json,secrets/v4_parquet_decimal_config.json,secrets/unstructured_config.jsonsource-gcssecrets/config_jsonl.jsonsource-gitlabsecrets/config_with_ids.jsonsource-google-adssecrets/config_click_view.json,secrets/config_manager_account.json,secrets/incremental_config.jsonsource-mysqlintegration_tests/temp/config_active.json,integration_tests/temp/config_cdc_active.jsonsource-shopifysecrets/config_transactions_with_user_id.jsonThese are all configs used for read/discovery scenarios, so their
checkis expected to succeed; if one does not, the new assertion surfaces a real problem rather than a false green. Still, this can turn currently-green CI red for those connectors, and the alternative (requiring an explicitstatusin the config) would break them immediately instead — flagging it for the reviewer to weigh in.Caveat on the stricter
EXPECT_EXCEPTIONassertionAirbyteEntrypoint.checkre-raises traced exceptions whosefailure_typeis notconfig_error, emitting noCONNECTION_STATUSmessage at all. A scenario declaringstatus: failedagainst a connector that hard-fails that way (rather than returningStatus.FAILEDgracefully) will now fail the standard test. That is the behavior the issue asks for — the platform treats a non-config error as an unexpected failure, so an acceptance-test scenario should not be silently satisfied by it — but if this proves too strict across the fleet, the leniency is a one-line revert inassert_check_outcome.Test Coverage
unit_tests/test/test_check_assertions.py(replacingunit_tests/test/test_docker_base_check_outcome.py) covers all three outcomes × (succeeded / failed / no status message), both againstassert_check_outcomedirectly and end-to-end throughrun_test_jobwith a syntheticSourcewhosecheckreports a fixed status (or raises). The in-process cases fail without this change.Declarative-First Evaluation
N/A — this is a CDK test-harness change, not a connector change.
Resolves https://github.com/airbytehq/airbyte-internal-issues/issues/17140:
airbytehq/airbyte-internal-issues#16212 should be closed once this lands (its remaining gap 2 is fixed here).
Link to Devin session: https://app.devin.ai/sessions/a3d02c9188e44c789e336784dced8888
Open in Devin Desktop: https://app.devin.ai/desktop/session/a3d02c9188e44c789e336784dced8888?variant=devin