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

Source Zendesk Support: fix tests #22483

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -2045,6 +2045,9 @@
icon: zendesk-support.svg
sourceType: api
releaseStage: generally_available
allowedHosts:
hosts:
- "${subdomain}.zendesk.com"
- name: Zendesk Talk
sourceDefinitionId: c8630570-086d-4a40-99ae-ea5b18673071
dockerRepository: airbyte/source-zendesk-talk
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ COPY source_zendesk_support ./source_zendesk_support
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]

LABEL io.airbyte.version=0.2.21
LABEL io.airbyte.version=0.2.22
LABEL io.airbyte.name=airbyte/source-zendesk-support
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ acceptance_tests:
- config_path: "secrets/config.json"
expect_records:
path: "integration_tests/expected_records.jsonl"
extra_fields: no
exact_order: no
extra_records: yes
incremental:
tests:
- config_path: "secrets/config.json"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,30 @@
"sync_mode": "full_refresh",
"destination_sync_mode": "append"
},
{
"stream": {
"name": "custom_roles",
"json_schema": {},
"supported_sync_modes": ["full_refresh", "incremental"],
"source_defined_cursor": true,
"default_cursor_field": ["updated_at"],
"source_defined_primary_key": [["id"]]
},
"sync_mode": "full_refresh",
"destination_sync_mode": "append"
},
{
"stream": {
"name": "brands",
"json_schema": {},
"supported_sync_modes": ["full_refresh", "incremental"],
"source_defined_cursor": true,
"default_cursor_field": ["updated_at"],
"source_defined_primary_key": [["id"]]
},
"sync_mode": "full_refresh",
"destination_sync_mode": "append"
},
{
"stream": {
"name": "macros",
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
from concurrent.futures import Future, ProcessPoolExecutor
from datetime import datetime, timedelta
from functools import partial

from airbyte_cdk.sources.streams.core import StreamData
from math import ceil
from pickle import PickleError, dumps
from typing import Any, Iterable, List, Mapping, MutableMapping, Optional, Union
Expand All @@ -27,6 +29,7 @@
from airbyte_cdk.sources.streams.http.exceptions import DefaultBackoffException
from airbyte_cdk.sources.streams.http.rate_limiting import TRANSIENT_EXCEPTIONS
from airbyte_cdk.sources.utils.transform import TransformConfig, TypeTransformer
from requests import HTTPError
from requests.auth import AuthBase
from requests_futures.sessions import PICKLE_ERROR, FuturesSession

Expand Down Expand Up @@ -535,6 +538,20 @@ class Tickets(SourceZendeskIncrementalExportStream):
response_list_name: str = "tickets"
transformer: TypeTransformer = TypeTransformer(TransformConfig.DefaultSchemaNormalization)

def read_records(
self,
sync_mode: SyncMode,
cursor_field: List[str] = None,
stream_slice: Mapping[str, Any] = None,
stream_state: Mapping[str, Any] = None,
) -> Iterable[StreamData]:
try:
yield from super(Tickets, self).read_records(sync_mode, cursor_field, stream_slice, stream_state)
except HTTPError as e:
if e.response.status_code == 400 and e.response.json().get('error', '') == 'StartTimeTooRecent':
return []
erohmensing marked this conversation as resolved.
Show resolved Hide resolved
raise e


class TicketComments(SourceZendeskSupportTicketEventsExportStream):
"""
Expand Down
1 change: 1 addition & 0 deletions docs/integrations/sources/zendesk-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ The Zendesk connector ideally should not run into Zendesk API limitations under

| Version | Date | Pull Request | Subject |
|:---------|:-----------|:---------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `0.2.22` | 2023-02-07 | [22483](https://github.com/airbytehq/airbyte/pull/22483) | Update expected records, fix `Tickets` to properly handle abnormal state |
| `0.2.21` | 2023-01-27 | [22027](https://github.com/airbytehq/airbyte/pull/22027) | Set `AvailabilityStrategy` for streams explicitly to `None` |
| `0.2.20` | 2022-12-28 | [20900](https://github.com/airbytehq/airbyte/pull/20900) | Remove synchronous time.sleep, add logging, reduce backoff time |
| `0.2.19` | 2022-12-09 | [19967](https://github.com/airbytehq/airbyte/pull/19967) | Fix reading response for more than 100k records |
Expand Down