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 Genesys: Use region specific API server #25598

Merged
merged 7 commits into from
Aug 1, 2023

Conversation

Shishir-rmv
Copy link
Contributor

@Shishir-rmv Shishir-rmv commented Apr 27, 2023

What

This solves: #22360

How

Use region specified in the configuration to select the relevant API URL. Maps region to API server as documented here

Recommended reading order

  1. airbyte-integrations/connectors/source-genesys/source_genesys/source.py
  2. airbyte-integrations/connectors/source-genesys/unit_tests/test_source.py
  3. airbyte-integrations/connectors/source-genesys/unit_tests/test_streams.py

🚨 User Impact 🚨

Are there any breaking changes? What is the end result perceived by the user?
No breaking changes

For connector PRs, use this section to explain which type of semantic versioning bump occurs as a result of the changes. Refer to our Semantic Versioning for Connectors guidelines for more information. Breaking changes to connectors must be documented by an Airbyte engineer (PR author, or reviewer for community PRs) by using the Breaking Change Release Playbook.

If there are breaking changes, please merge this PR with the 🚨🚨 emoji so changelog authors can further highlight this if needed.

Pre-merge Checklist

Expand the relevant checklist and delete the others.

Updating a connector

Community member or Airbyter

  • Grant edit access to maintainers (instructions)

  • Secrets in the connector's spec are annotated with airbyte_secret

  • Unit & integration tests added and passing. Community members, please provide proof of success locally e.g: screenshot or copy-paste unit, integration, and acceptance test output. To run acceptance tests for a Python connector, follow instructions in the README. For java connectors run ./gradlew :airbyte-integrations:connectors:<name>:integrationTest.

  • Code reviews completed

  • Connector version has been incremented

  • Documentation updated

    • Connector's README.md
    • Connector's bootstrap.md. See description and examples
    • Changelog updated in docs/integrations/<source or destination>/<name>.md with an entry for the new version. See changelog example
  • PR name follows PR naming conventions

Airbyter

If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.

  • Create a non-forked branch based on this PR and test the below items on it
  • Build is successful
  • If new credentials are required for use in CI, add them to GSM. Instructions.
  • /test connector=connectors/<name> command is passing
  • New Connector version released on Dockerhub and connector version bumped by running the /publish command described here

@Shishir-rmv
Copy link
Contributor Author

Unit tests

❯ coverage run -m pytest unit_tests && coverage report -m
Test session starts (platform: darwin, Python 3.9.11, pytest 6.2.5, pytest-sugar 0.9.7)
cachedir: .pytest_cache
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('/Users/sverma/code/github.com/Shishir-rmv/airbyte/airbyte-integrations/connectors/source-genesys/.hypothesis/examples')
rootdir: /Users/sverma/code/github.com/Shishir-rmv/airbyte, configfile: pytest.ini
plugins: hypothesis-6.54.6, requests-mock-1.9.3, mock-3.6.1, sugar-0.9.7, timeout-1.4.2, cov-3.0.0
collected 22 items

 airbyte-integrations/connectors/source-genesys/unit_tests/test_source.py::test_check_connection ✓                                                                                                                                                5% ▌
 airbyte-integrations/connectors/source-genesys/unit_tests/test_source.py::test_streams ✓                                                                                                                                                         9% ▉
 airbyte-integrations/connectors/source-genesys/unit_tests/test_source.py::test_url_base[Americas (US East)-https://api.mypurecloud.com/api/v2/] ✓                                                                                               14% █▍
 airbyte-integrations/connectors/source-genesys/unit_tests/test_source.py::test_url_base[Americas (US East 2)-https://api.use2.us-gov-pure.cloud/api/v2/] ✓                                                                                      18% █▊
 airbyte-integrations/connectors/source-genesys/unit_tests/test_source.py::test_url_base[Americas (US West)-https://api.usw2.pure.cloud/api/v2/] ✓                                                                                               23% ██▍
 airbyte-integrations/connectors/source-genesys/unit_tests/test_source.py::test_url_base[Americas (Canada)-https://api.cac1.pure.cloud/api/v2/] ✓                                                                                                27% ██▊
 airbyte-integrations/connectors/source-genesys/unit_tests/test_source.py::test_url_base[Americas (S\xe3o Paulo)-https://api.sae1.pure.cloud/api/v2/] ✓                                                                                          32% ███▎
 airbyte-integrations/connectors/source-genesys/unit_tests/test_source.py::test_url_base[EMEA (Frankfurt)-https://api.mypurecloud.de/api/v2/] ✓                                                                                                  36% ███▋
 airbyte-integrations/connectors/source-genesys/unit_tests/test_source.py::test_url_base[EMEA (Dublin)-https://api.mypurecloud.ie/api/v2/] ✓                                                                                                     41% ████▏
 airbyte-integrations/connectors/source-genesys/unit_tests/test_source.py::test_url_base[EMEA (London)-https://api.euw2.pure.cloud/api/v2/] ✓                                                                                                    45% ████▋
 airbyte-integrations/connectors/source-genesys/unit_tests/test_source.py::test_url_base[Asia Pacific (Mumbai)-https://api.aps1.pure.cloud/api/v2/] ✓                                                                                            50% █████
 airbyte-integrations/connectors/source-genesys/unit_tests/test_source.py::test_url_base[Asia Pacific (Seoul)-https://api.apne2.pure.cloud/api/v2/] ✓                                                                                            55% █████▌
 airbyte-integrations/connectors/source-genesys/unit_tests/test_source.py::test_url_base[Asia Pacific (Sydney)-https://api.mypurecloud.com.au/api/v2/] ✓                                                                                         59% █████▉
 airbyte-integrations/connectors/source-genesys/unit_tests/test_streams.py::test_request_params ✓                                                                                                                                                64% ██████▍
 airbyte-integrations/connectors/source-genesys/unit_tests/test_streams.py::test_request_headers ✓                                                                                                                                               68% ██████▊
 airbyte-integrations/connectors/source-genesys/unit_tests/test_streams.py::test_http_method ✓                                                                                                                                                   73% ███████▍
 airbyte-integrations/connectors/source-genesys/unit_tests/test_streams.py::test_should_retry[HTTPStatus.OK-False] ✓                                                                                                                             77% ███████▊
 airbyte-integrations/connectors/source-genesys/unit_tests/test_streams.py::test_should_retry[HTTPStatus.BAD_REQUEST-False] ✓                                                                                                                    82% ████████▎
 airbyte-integrations/connectors/source-genesys/unit_tests/test_streams.py::test_should_retry[HTTPStatus.TOO_MANY_REQUESTS-True] ✓                                                                                                               86% ████████▋
 airbyte-integrations/connectors/source-genesys/unit_tests/test_streams.py::test_should_retry[HTTPStatus.INTERNAL_SERVER_ERROR-True] ✓                                                                                                           91% █████████▏
 airbyte-integrations/connectors/source-genesys/unit_tests/test_streams.py::test_backoff_time ✓                                                                                                                                                  95% █████████▋
 airbyte-integrations/connectors/source-genesys/unit_tests/test_streams.py::test_url_base ✓                                                                                                                                                     100% ██████████
====================================================================================================================== warnings summary =======================================================================================================================
airbyte-integrations/connectors/source-genesys/unit_tests/test_source.py: 192 warnings
airbyte-integrations/connectors/source-genesys/unit_tests/test_streams.py: 9 warnings
  /Users/sverma/code/github.com/Shishir-rmv/airbyte/airbyte-integrations/connectors/source-genesys/.venv/lib/python3.9/site-packages/airbyte_cdk/sources/streams/http/http.py:45: DeprecationWarning: Call to deprecated class NoAuth. (Set `authenticator=None` instead) -- Deprecated since version 0.1.20.
    self._authenticator: HttpAuthenticator = NoAuth()

airbyte-integrations/connectors/source-genesys/unit_tests/test_source.py: 192 warnings
airbyte-integrations/connectors/source-genesys/unit_tests/test_streams.py: 9 warnings
  /Users/sverma/code/github.com/Shishir-rmv/airbyte/airbyte-integrations/connectors/source-genesys/.venv/lib/python3.9/site-packages/deprecated/classic.py:173: DeprecationWarning: Call to deprecated class HttpAuthenticator. (Use requests.auth.AuthBase instead) -- Deprecated since version 0.1.20.
    return old_new1(cls, *args, **kwargs)

-- Docs: https://docs.pytest.org/en/stable/warnings.html

Results (0.41s):
      22 passed
Name                             Stmts   Miss  Cover   Missing
--------------------------------------------------------------
source_genesys/__init__.py           2      0   100%
source_genesys/authenicator.py      12      3    75%   19-26
source_genesys/source.py           121     24    80%   31-36, 45, 49-50, 61, 74, 86, 97, 109, 121, 133, 145, 157, 169, 181, 193, 205, 216, 227, 239, 245
unit_tests/__init__.py               0      0   100%
unit_tests/test_source.py           26      0   100%
unit_tests/test_streams.py          37      0   100%
--------------------------------------------------------------
TOTAL                              198     27    86%

@octavia-squidington-iii octavia-squidington-iii added the area/documentation Improvements or additions to documentation label Apr 27, 2023
@Shishir-rmv Shishir-rmv requested a review from marcosmarxm April 28, 2023 00:35
@Shishir-rmv
Copy link
Contributor Author

@marcosmarxm - I've refactored the code. Please review.

@Shishir-rmv
Copy link
Contributor Author

@sajarin @marcosmarxm - Gentle reminder to review this PR. Thanks!

Copy link

@seanglynn-thrive seanglynn-thrive left a comment

Choose a reason for hiding this comment

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

Looks good 👍

@Shishir-rmv
Copy link
Contributor Author

@sajarin @marcosmarxm - Gentle reminder to review this PR. Thanks!

@jrolom jrolom removed the bounty label May 29, 2023
@marcosmarxm marcosmarxm added team/tse Technical Support Engineers community and removed community-legacy labels Jun 27, 2023
@marcosmarxm
Copy link
Member

Hello @Shishir-rmv right now Genesys CI is broken and the PR is in our backlog. Hope to get any update in next weeks.

Copy link
Member

@marcosmarxm marcosmarxm left a comment

Choose a reason for hiding this comment

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

Thanks @Shishir-rmv right now the tests aren't working but the implementation looks correct.

@marcosmarxm
Copy link
Member

/approve-and-merge reason="no credentials to run tests"

@octavia-approvington
Copy link
Contributor

Lets merge it
sheep thumbs up

@octavia-approvington octavia-approvington merged commit c199724 into airbytehq:master Aug 1, 2023
bnchrch pushed a commit that referenced this pull request Aug 3, 2023
* use api url corresponding to region specified in the config

* update unit tests

* bump up version

* refactor
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 community connectors/source/genesys team/tse Technical Support Engineers
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

6 participants