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

🎉 CAT: Add allowedHosts and suggestedSteams checks for metadata.yaml for connectors ql >= 400 #34358

Merged
merged 9 commits into from
Jan 26, 2024

Conversation

bazarnov
Copy link
Collaborator

@bazarnov bazarnov commented Jan 18, 2024

What

Resolving: #33566

How

  • added two new tests to connector_attribute test suite:
    • test_certified_connector_has_allowed_hosts
    • test_certified_connector_has_suggested_streams
  • covered cases with corresponding unit_tests

Tests

The tests were running against source-faker, with modified acceptance-test-config.yml:

connector_image: airbyte/source-faker:dev
acceptance_tests:
  spec:
    tests:
      - spec_path: "integration_tests/spec.json"
  connector_attributes:
    tests:
      - config_path: "secrets/config.json"
        allowed_hosts:
           bypass_reason: "Description of why the `AllowedHosts` check is skipped"
        suggested_streams:
           bypass_reason: "Description of why the `SuggestedStreams` check is skipped"
  ...
  ...

To check the use-cases, please refer to the unit_tests.

🚨 User Impact 🚨

No impact is expected, to enable additional metadata.yaml checks, the connector_attributes config, should be supplied in the acceptance-test-config.yml as shown above, for each target connector.

@bazarnov bazarnov self-assigned this Jan 18, 2024
@bazarnov bazarnov requested a review from a team January 18, 2024 18:25
Copy link

vercel bot commented Jan 18, 2024

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

Name Status Preview Comments Updated (UTC)
airbyte-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 26, 2024 1:51pm

@bazarnov bazarnov changed the title 🎉 CAT: Add allowedHosts and suggestedSteams checks for metadata.yaml for connectors >= ql: 400 🎉 CAT: Add allowedHosts and suggestedSteams checks for metadata.yaml for connectors ql >= 400 Jan 18, 2024
@bazarnov bazarnov requested review from a team January 18, 2024 18:29
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.

a couple of nits and suggestions, will approve afterwards

@@ -197,6 +209,10 @@ class ConnectorAttributesConfig(BaseConfig):
streams_without_primary_key: Optional[List[NoPrimaryKeyConfiguration]] = Field(
description="Streams that do not support a primary key such as reports streams"
)
allowed_hosts: Optional[AllowedHostsConfiguration] = Field(
description="The list of external whitelisted resources the connector is allowed to communicate with."
Copy link
Contributor

Choose a reason for hiding this comment

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

This and the suggested_streams descriptions aren't quite accurate. These are describing how the field is used in the metadata.yaml, but we should actually use a description that this setting is used when a source does not have external resources for example:

"Used to bypass checking the allowedHosts field in a source's metadata.yaml when all external hosts should be reachable"

And the same for suggested_streams, we should say that this is intended to be the override field not the suggested streams themselves

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Changed.

metadata = connector_metadata.get("data", {})

has_allowed_hosts_property = "allowedHosts" in metadata.keys()
assert has_allowed_hosts_property, f"The `AllowedHosts` property is missing in `metadata.data` for `metadata.yaml`."
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: but in metadata.yaml is defined as camel case not capitalized: allowedHosts

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Corrected.

@bazarnov bazarnov requested a review from brianjlai January 25, 2024 10:54
@bazarnov
Copy link
Collaborator Author

@brianjlai The review comments were considered, please checkout.

@bazarnov bazarnov requested a review from maxi297 January 26, 2024 13:33
@bazarnov
Copy link
Collaborator Author

@maxi297 Could you please finalize the review from the part of Airbyte? Thank you.

Copy link
Contributor

@maxi297 maxi297 left a comment

Choose a reason for hiding this comment

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

:shipit:

@bazarnov bazarnov merged commit 7594c36 into master Jan 26, 2024
25 checks passed
@bazarnov bazarnov deleted the baz/baz/cat/add-allowedhosts-suggestedstreams-tests branch January 26, 2024 13:57
jatinyadav-cc pushed a commit to ollionorg/datapipes-airbyte that referenced this pull request Feb 21, 2024
jatinyadav-cc pushed a commit to ollionorg/datapipes-airbyte that referenced this pull request Feb 26, 2024
jatinyadav-cc pushed a commit to ollionorg/datapipes-airbyte that referenced this pull request Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/documentation Improvements or additions to documentation team/connectors-python
Projects
No open projects
Status: No status
Development

Successfully merging this pull request may close these issues.

Add CAT scenario that validates connector's metadata.yaml specifies allowed hosts and suggested streams
6 participants