Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CDK: assert >0 state messages per read (fix tests) #35906

Merged
merged 8 commits into from Mar 8, 2024

Conversation

erohmensing
Copy link
Contributor

@erohmensing erohmensing commented Mar 7, 2024

What

How

  • Add an assertion that we get at least 1 state message for a successful sync
  • Fix some tests that previously "output 0 expected records" but actually errored silently - do not run them as read tests
  • Fix a test that failed silently due to lack of support for multi-format
  • Add a new test for syncs that output 0 records successfully

🚨 User Impact 🚨

None - test changes

Pre-merge Actions

Expand the relevant checklist and delete the others.

New Connector

Community member or Airbyter

  • Community member? Grant edit access to maintainers (instructions)
  • Unit & integration tests added and passing. Community members, please provide proof of success locally e.g: screenshot or copy-paste unit, integration, and acceptance test output. To run acceptance tests for a Python connector, follow instructions in the README. For java connectors run ./gradlew :airbyte-integrations:connectors:<name>:integrationTest.
  • Connector version is set to 0.0.1
    • Dockerfile has version 0.0.1
  • Documentation updated
    • Connector's README.md
    • Connector's bootstrap.md. See description and examples
    • docs/integrations/<source or destination>/<name>.md including changelog with an entry for the initial version. See changelog example
    • docs/integrations/README.md

Airbyter

If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.

  • Create a non-forked branch based on this PR and test the below items on it
  • Build is successful
  • If new credentials are required for use in CI, add them to GSM. Instructions.
Updating a connector

Community member or Airbyter

  • Grant edit access to maintainers (instructions)
  • Unit & integration tests added

Airbyter

If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.

  • Create a non-forked branch based on this PR and test the below items on it
  • Build is successful
  • If new credentials are required for use in CI, add them to GSM. Instructions.
Connector Generator
  • Issue acceptance criteria met
  • PR name follows PR naming conventions
  • If adding a new generator, add it to the list of scaffold modules being tested
  • The generator test modules (all connectors with -scaffold in their name) have been updated with the latest scaffold by running ./gradlew :airbyte-integrations:connector-templates:generator:generateScaffolds then checking in your changes
  • Documentation which references the generator is updated as needed
Updating the Python CDK

Airbyter

Before merging:

  • Pull Request description explains what problem it is solving
  • Code change is unit tested
  • Build and my-py check pass
  • Smoke test the change on at least one affected connector
    • On Github: Run this workflow, passing --use-local-cdk --name=source-<connector> as options
    • Locally: airbyte-ci connectors --use-local-cdk --name=source-<connector> test
  • PR is reviewed and approved

After merging:

  • Publish the CDK
    • The CDK does not follow proper semantic versioning. Choose minor if this the change has significant user impact or is a breaking change. Choose patch otherwise.
    • Write a thoughtful changelog message so we know what was updated.
  • Merge the platform PR that was auto-created for updating the Connector Builder's CDK version
    • This step is optional if the change does not affect the connector builder or declarative connectors.

Copy link

vercel bot commented Mar 7, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
airbyte-docs ⬜️ Ignored (Inspect) Visit Preview Mar 8, 2024 10:09pm

Copy link
Contributor Author

erohmensing commented Mar 7, 2024

Copy link
Contributor

@brianjlai brianjlai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@@ -467,48 +467,46 @@
)
).build()

multi_format_analytics_scenario: TestScenario[InMemoryFilesSource] = (
csv_analytics_scenario: TestScenario[InMemoryFilesSource] = (
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test used to test analytics for multi-format. However, we don't actually support multi format. Although the analytics come out, the read fails silently, which means that we don't get the state message we expect.

Instead, we test the analytics separately (for the cases we do support - one format) and don't allow a read to silently fail.

@@ -1450,7 +1487,6 @@
}
)
.set_expected_discover_error(AirbyteTracedException, FileBasedSourceError.SCHEMA_INFERENCE_ERROR.value)
.set_expected_records([])
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These 2 scenarios were scenarios that fail discover. They previously had "0 expected records", but fail silently if sent through the read tests. Instead, they are still discover scenarios, but no longer read scenarios - if discover fails, we don't expect the read to succeed.

These in particular don't assert any specific expected errors, which hints toward silent failure. If we got these cases to yell more aggressively about their errors, we could bring them back as read tests with expected errors.

.set_expected_discover_error(AirbyteTracedException, FileBasedSourceError.SCHEMA_INFERENCE_ERROR.value)
).build()

csv_no_records_scenario: TestScenario[InMemoryFilesSource] = (
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New scenario - a basic test for if we get 0 records in an expected, okay way. Essentially - if there's no data available, we expect 0 records, and I added this case to make sure that even if 0 records are synced, we get a state message.

Comment on lines +156 to +162
discover_failure_scenarios = [
earlier_csv_scenario,
empty_schema_inference_scenario,
]

discover_success_scenarios = [
csv_no_records_scenario,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See other comment - not all discover scenarios can be used as read scenarios, as some that fail discover do not read successfully (in that they don't error successfully either)

@erohmensing erohmensing requested a review from clnoll March 8, 2024 04:18
@erohmensing erohmensing marked this pull request as ready for review March 8, 2024 04:20
@erohmensing erohmensing requested a review from a team as a code owner March 8, 2024 04:20
Copy link
Contributor

@brianjlai brianjlai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️

@octavia-squidington-iv octavia-squidington-iv requested review from a team March 8, 2024 17:56
Base automatically changed from final-state-cursor to master March 8, 2024 21:58
@erohmensing erohmensing force-pushed the nonzero-num-state-messages-fixes branch from ae515d5 to 7ee8a18 Compare March 8, 2024 22:04
@erohmensing erohmensing merged commit a4dca3b into master Mar 8, 2024
27 checks passed
@erohmensing erohmensing deleted the nonzero-num-state-messages-fixes branch March 8, 2024 22:21
Copy link
Contributor Author

Merge activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CDK Connector Development Kit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants