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

SAT: Capture configuration updates from connectors' control messages #19979

Merged
merged 10 commits into from
Dec 6, 2022

Conversation

alafanechere
Copy link
Contributor

@alafanechere alafanechere commented Dec 1, 2022

What

1/2 of this issue.

#19428 introduced a new CDK feature: connectors can emit control messages to update their configuration.
The latest emitted configuration should be used on the next connector operations.

We need to make SAT capable of:

  1. Reading control messages emitted by connectors under test
  2. Storing updated configurations
  3. Using the latest updated configurations in tests

Demo 👀

Loom video

How

  1. Tweak source-bing-ads for testing: make its config observed and produce control messages on token refresh <- reverted
  2. Change ConnectorRunner.run to process control messages that are updating configuration:
  3. Implement ConnectorRunner._persist_new_configuration to store new configurations to an updated_configurations folder (e.g. secrets/updated_configurations/config|{update-time}.json)
    def _persist_new_configuration(self, new_configuration: dict, configuration_emitted_at: int) -> Optional[Path]:
  4. Change the connector_configuration_path fixture to retrieve the latest updated configuration if any:
    def connector_config_path_fixture(inputs, base_path) -> Path:

🚨 User Impact 🚨

This should not impact existing SAT run as no connector is yet emitting CONTROL messages.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 1, 2022

Affected Connector Report

NOTE ⚠️ Changes in this PR affect the following connectors. Make sure to do the following as needed:

  • Run integration tests
  • Bump connector or module version
  • Add changelog
  • Publish the new version

❌ Sources (64)

Connector Version Changelog Publish
source-airtable 0.1.3
source-amazon-ads 0.1.25
source-amazon-seller-partner 0.2.28
source-amazon-sqs 0.1.0
source-amplitude 0.1.17
source-appsflyer 0.1.0
source-asana 0.1.5
source-azure-table 0.1.3
source-braintree 0.1.3
source-cart 0.2.0
source-chargebee 0.1.16
source-commercetools 0.1.0
source-confluence 0.1.1
source-datadog 0.1.0
source-delighted 0.1.4
source-drift 0.2.5
source-facebook-marketing 0.2.76
source-facebook-pages 0.1.6
source-freshcaller 0.1.0
source-freshsales 0.1.2
source-freshservice 0.1.1
source-github 0.3.8
source-gitlab 0.1.8
source-google-ads 0.2.5
source-google-search-console 0.1.18
source-greenhouse 0.3.0
source-harvest 0.1.11
source-instagram 1.0.0
source-iterable 0.1.22
source-klaviyo 0.1.10
source-lemlist 0.1.1
source-lever-hiring 0.1.3
source-linnworks 0.1.5
source-mailchimp 0.3.0
source-mailgun 0.1.0
source-monday 0.1.4
source-notion 0.1.10
source-okta 0.1.13
source-onesignal 0.1.2
source-openweather 0.1.6
source-outreach 0.1.2
source-pardot 0.1.0
source-paystack 0.1.1
source-pinterest 0.1.9
source-pipedrive 0.1.13
source-plaid 0.3.2
(changelog missing)
source-posthog 0.1.7
source-prestashop 0.3.0
source-quickbooks-singer 0.1.5
(doc not found)
source-recharge 0.2.4
source-retently 0.1.2
source-salesforce 1.0.27
source-salesloft 0.1.3
source-sendgrid 0.2.16
source-sentry 0.1.7
source-strava 0.1.2
source-surveymonkey 0.1.13
source-tplcentral 0.1.1
source-twilio 0.1.14
source-weatherstack 0.1.0
source-youtube-analytics 0.1.3
source-zendesk-sunshine 0.1.1
source-zendesk-talk 0.1.5
source-zenloop 0.1.3
  • See "Actionable Items" below for how to resolve warnings and errors.

✅ Destinations (0)

Connector Version Changelog Publish
  • See "Actionable Items" below for how to resolve warnings and errors.

✅ Other Modules (0)

Actionable Items

(click to expand)

Category Status Actionable Item
Version
mismatch
The version of the connector is different from its normal variant. Please bump the version of the connector.

doc not found
The connector does not seem to have a documentation file. This can be normal (e.g. basic connector like source-jdbc is not published or documented). Please double-check to make sure that it is not a bug.
Changelog
doc not found
The connector does not seem to have a documentation file. This can be normal (e.g. basic connector like source-jdbc is not published or documented). Please double-check to make sure that it is not a bug.

changelog missing
There is no chnagelog for the current version of the connector. If you are the author of the current version, please add a changelog.
Publish
not in seed
The connector is not in the seed file (e.g. source_definitions.yaml), so its publication status cannot be checked. This can be normal (e.g. some connectors are cloud-specific, and only listed in the cloud seed file). Please double-check to make sure that it is not a bug.

diff seed version
The connector exists in the seed file, but the latest version is not listed there. This usually means that the latest version is not published. Please use the /publish command to publish the latest version.

@alafanechere alafanechere marked this pull request as ready for review December 2, 2022 11:56
@alafanechere
Copy link
Contributor Author

alafanechere commented Dec 2, 2022

/test connector=connectors/source-bing-ads

🕑 connectors/source-bing-ads https://github.com/airbytehq/airbyte/actions/runs/3601629813
❌ connectors/source-bing-ads https://github.com/airbytehq/airbyte/actions/runs/3601629813
🐛 https://gradle.com/s/pyi5xyokdru6i

Build Failed

Test summary info:

Could not find result summary

@alafanechere
Copy link
Contributor Author

alafanechere commented Dec 2, 2022

TODO: Revert changes on source-bings-ads.

@evantahler
Copy link
Contributor

Link your demo look video to the PR!

@evantahler
Copy link
Contributor

evantahler commented Dec 2, 2022

I'll fixup source-plaid's changelog
Edit - I think I merged that fix in yesterday - should be good if you merge in master

@alafanechere
Copy link
Contributor Author

Link your demo look video to the PR!

I think I already did 😄

Copy link
Contributor

@sherifnada sherifnada left a comment

Choose a reason for hiding this comment

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

some comments and questions but nothing blocking

auth_creds = {
"client_id": client_id,
@property
def auth_creds(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: signatures

"redirection_uri": "", # should be empty string
"client_secret": None,
"tenant": tenant_id,
Copy link
Contributor

Choose a reason for hiding this comment

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

do we not need tenant?

@@ -93,6 +95,7 @@ def call_read_with_state(self, config, catalog, state, **kwargs) -> List[Airbyte
return output

def run(self, cmd, config=None, state=None, catalog=None, raise_container_error: bool = True, **kwargs) -> Iterable[AirbyteMessage]:
Copy link
Contributor

Choose a reason for hiding this comment

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

does the calling context automatically get this new config? if yes can you clarify how in a comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All the tests using the ConnectorRunner are using the connector_config fixture (also function scoped) . The connector_config fixture is loading the config from the connector_config_path fixture. The connector_config_path fixture dynamically retrieves the latest configuration written to theupdated_configurations folder. So all tests using connector_config fixture are calling docker_runner methods with the "new" config.

I don't think clarifying the behavior here is a good idea as it's fixture related, not an internal logic of the runner. I wrote something here in the connector_config_path fixture.

@alafanechere
Copy link
Contributor Author

Thanks @sherifnada for your review. I answered your comments about SAT.
I'm not going to make additional changes to the bing ads connector change as I only quickly modified this connector for testing and will revert the changes made in this PR.

@sherifnada
Copy link
Contributor

@alafanechere makes sense, thank you for the clarifications! LGTM :)

@alafanechere
Copy link
Contributor Author

alafanechere commented Dec 6, 2022

/publish connector=bases/source-acceptance-test auto-bump-version=false

🕑 Publishing the following connectors:
bases/source-acceptance-test
https://github.com/airbytehq/airbyte/actions/runs/3629414545


Connector Did it publish? Were definitions generated?
bases/source-acceptance-test

if you have connectors that successfully published but failed definition generation, follow step 4 here ▶️

@alafanechere alafanechere merged commit d28964c into master Dec 6, 2022
@alafanechere alafanechere deleted the augustin/sat/capture-config-messages branch December 6, 2022 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants