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

Feat: Add docker image override for connectors in Cloud #420

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
updates/tweaks for check_connection
aaronsteers committed Dec 11, 2024
commit 6cebe55632f5bf26cb47677df3886fa638dd2547
12 changes: 8 additions & 4 deletions airbyte/_util/api_util.py
Original file line number Diff line number Diff line change
@@ -750,17 +750,21 @@ def get_bearer_token(
"""Get a bearer token.

https://reference.airbyte.com/reference/createaccesstoken

"""
path = api_root + "/applications/token"
headers: dict[str, str] = {
"content-type": "application/json",
"accept": "application/json",
}
request_body: dict[str, str] = {
"grant-type": "client_credentials",
"grant_type": "client_credentials",
"client_id": client_id,
"client_secret": client_secret,
}
# if "api.airbyte" not in api_root:
# request_body["grant_type"] = "client_credentials"

response = requests.request(
method="POST",
url=path,
@@ -785,10 +789,10 @@ def check_connector(
) -> tuple[bool, str | None]:
"""Check a source.

Raises an exception if the check fails.
Raises an exception if the check fails. Uses one of these endpoints:

https://github.com/airbytehq/airbyte-platform-internal/blob/10bb92e1745a282e785eedfcbed1ba72654c4e4e/oss/airbyte-api/server-api/src/main/openapi/config.yaml#L1409
https://github.com/airbytehq/airbyte-platform-internal/blob/10bb92e1745a282e785eedfcbed1ba72654c4e4e/oss/airbyte-api/server-api/src/main/openapi/config.yaml#L1995
- /v1/sources/check_connection: https://github.com/airbytehq/airbyte-platform-internal/blob/10bb92e1745a282e785eedfcbed1ba72654c4e4e/oss/airbyte-api/server-api/src/main/openapi/config.yaml#L1409
- /v1/destinations/check_connection: https://github.com/airbytehq/airbyte-platform-internal/blob/10bb92e1745a282e785eedfcbed1ba72654c4e4e/oss/airbyte-api/server-api/src/main/openapi/config.yaml#L1995
"""
_ = workspace_id # Not used (yet)
bearer_token: SecretString = get_bearer_token(
26 changes: 2 additions & 24 deletions tests/integration_tests/cloud/test_cloud_api_util.py
Original file line number Diff line number Diff line change
@@ -263,8 +263,8 @@ def test_get_bearer_token(
@pytest.mark.parametrize(
"connector_id, connector_type, expect_success",
[
("0f766e9e-636e-4687-8483-f2febc46d9ce", "source", True),
# ("test_connector_id", "destination", True),
("f45dd701-d1f0-4e8e-97c4-2b89c40ac928", "source", True),
# ("......-....-....-....-............", "destination", True),
],
)
def test_check_connector(
@@ -286,25 +286,3 @@ def test_check_connector(
pytest.fail("check_connector function is not implemented")
except AirbyteError as e:
pytest.fail(f"API call failed: {e}")


def test_check_connector_integration(
api_root,
airbyte_cloud_client_id,
airbyte_cloud_client_secret,
) -> None:
actor_id = "test_actor_id"
connector_type = "source"
try:
result, error_message = check_connector(
actor_id=actor_id,
connector_type=connector_type,
client_id=airbyte_cloud_client_id,
client_secret=airbyte_cloud_client_secret,
api_root=api_root,
)
assert result is not None
except NotImplementedError:
pytest.fail("check_connector function is not implemented")
except AirbyteError as e:
pytest.fail(f"API call failed: {e}")