Skip to content

✨ Source Zendesk Support: add tests and clean-up #55676

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

maxi297
Copy link
Contributor

@maxi297 maxi297 commented Mar 10, 2025

What

Partially addresses https://github.com/airbytehq/airbyte-internal-issues/issues/11894

Preparing for the migration to low-code:

  • I added mock server tests for the posts stream
  • I set up state parsing so that we can revert when we will migrate to low-code. I'm not sure how useful this is given that we won't be able to revert the states for some of the migration to low-code like post_comments which will become a per-partition state but the change was quite simple so why not?

How

For the posts stream supporting low-code state, see streams.py and test_given_input_state_with_low_code_format_when_read_then_set_state_value_to_most_recent_cursor_value

Review guide

User Impact

Can this PR be safely reverted and rolled back?

  • YES 💚
  • NO ❌

Copy link

vercel bot commented Mar 10, 2025

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 Mar 21, 2025 7:24pm

@octavia-squidington-iii octavia-squidington-iii added the area/connectors Connector related issues label Mar 10, 2025
response["meta"]["has_more"] = True
response["meta"]["after_cursor"] = "after-cursor"
response["meta"]["before_cursor"] = "before-cursor"
if self._first_url:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The low-code version implemented a links_next_paginator that relies on links.next and not on meta.after_cursor hence I updated this strategy to support both

@@ -32,6 +32,8 @@ acceptance_tests:
bypass_reason: "not available in current subscription plan"
- name: "post_comment_votes"
bypass_reason: "not available in current subscription plan"
- name: "ticket_activities"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Based on https://connectors.airbyte.com/files/generated_reports/test_summary/source-zendesk-support/index.html, this is failing for a week now. The retention period is 30 days which means we would need to create some data every 30 days for this stream. I prefer just disabling it for now

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.

two non blocking questions. otherwise LGTM

from .zs_responses.records import PostsRecordBuilder


_NOW = datetime.now(timezone.utc)
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe a dumb question, but why do we need to use two different libraries to get _NOW and _START_DATE?

are we be unable to use pendulum.now(tz="UTC") when we convert to isoformat() in the freezegun decorator?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know but I think that our reasoning should be to move away from pendulum because it's not supported anymore. I haven't done so because there are a lot of utils relying on it. I wanted to use Devin and try to ask it to move remove all the usages of pendulum eventually. I kicked off the job but didn't check the result yet...

@@ -261,7 +261,7 @@ def get_stream_state_value(self, stream_state: Mapping[str, Any] = None) -> int:
Returns the state value, if exists. Otherwise, returns user defined `Start Date`.
"""
state = stream_state.get(self.cursor_field) or self._start_date if stream_state else self._start_date
return calendar.timegm(pendulum.parse(state).utctimetuple())
return int(state) if isinstance(state, int) or state.isdigit() else calendar.timegm(pendulum.parse(state).utctimetuple())
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't have an issue w/ the code, but i'm interested in how this got surfaced. Was there a customer that saw this as an issue or was this just found when you were writing mock server tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is not a bug. It is to have this test pass. However, there are so few users in prod that I don't think we intend to revert. We could just remove that honestly...

Copy link
Contributor

@artem1205 artem1205 left a comment

Choose a reason for hiding this comment

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

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/connectors Connector related issues area/documentation Improvements or additions to documentation connectors/source/zendesk-support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants