Skip to content

Commit

Permalink
🐛 Destination typesense: Update check() to mitigate "check() takes 2 …
Browse files Browse the repository at this point in the history
…positional arguments but 3 were given" (#34336)

Co-authored-by: Marcos Marx <marcosmarxm@users.noreply.github.com>
Co-authored-by: marcosmarxm <marcosmarxm@gmail.com>
  • Loading branch information
3 people committed Jan 19, 2024
1 parent d88104e commit 86f3c7d
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ COPY destination_typesense ./destination_typesense
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]

LABEL io.airbyte.version=0.1.2
LABEL io.airbyte.version=0.1.3
LABEL io.airbyte.name=airbyte/destination-typesense
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from typing import Any, Iterable, Mapping

from airbyte_cdk import AirbyteLogger
from airbyte_cdk.destinations import Destination
from airbyte_cdk.models import AirbyteConnectionStatus, AirbyteMessage, ConfiguredAirbyteCatalog, DestinationSyncMode, Status, Type
from destination_typesense.writer import TypesenseWriter
Expand Down Expand Up @@ -49,7 +50,8 @@ def write(
continue
writer.flush()

def check(self, config: Mapping[str, Any]) -> AirbyteConnectionStatus:
def check(self, logger: AirbyteLogger, config: Mapping[str, Any]) -> AirbyteConnectionStatus:
logger.debug("TypeSense Destination Config Check")
try:
client = get_client(config=config)
client.collections.create({"name": "_airbyte", "fields": [{"name": "title", "type": "string"}]})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from typing import Any, Dict, Mapping

import pytest
from airbyte_cdk import AirbyteLogger
from airbyte_cdk.models import (
AirbyteMessage,
AirbyteRecordMessage,
Expand Down Expand Up @@ -59,12 +60,12 @@ def client_fixture(config) -> Client:


def test_check_valid_config(config: Mapping):
outcome = DestinationTypesense().check(config)
outcome = DestinationTypesense().check(AirbyteLogger(), config)
assert outcome.status == Status.SUCCEEDED


def test_check_invalid_config():
outcome = DestinationTypesense().check({"api_key": "not_a_real_key", "host": "https://www.fake.com"})
outcome = DestinationTypesense().check(AirbyteLogger(), {"api_key": "not_a_real_key", "host": "https://www.fake.com"})
assert outcome.status == Status.FAILED


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ data:
connectorSubtype: database
connectorType: destination
definitionId: 36be8dc6-9851-49af-b776-9d4c30e4ab6a
dockerImageTag: 0.1.2
dockerImageTag: 0.1.3
dockerRepository: airbyte/destination-typesense
githubIssueLabel: destination-typesense
icon: typesense.svg
Expand Down
1 change: 1 addition & 0 deletions docs/integrations/destinations/typesense.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ The setup only requires two fields. First is the `host` which is the address at

| Version | Date | Pull Request | Subject |
| :------ | :--------- | :------------------------------------------------------- | :---------------------------- |
| 0.1.3 | 2024-01-17 | [34336](https://github.com/airbytehq/airbyte/pull/34336) | Fix check() arguments error |
| 0.1.2 | 2023-08-25 | [29817](https://github.com/airbytehq/airbyte/pull/29817) | Fix writing multiple streams |
| 0.1.1 | 2023-08-24 | [29555](https://github.com/airbytehq/airbyte/pull/29555) | Increasing connection timeout |
| 0.1.0 | 2022-10-28 | [18349](https://github.com/airbytehq/airbyte/pull/18349) | New Typesense destination |

0 comments on commit 86f3c7d

Please sign in to comment.