-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
馃帀 New Source: Hubplanner #12145
馃帀 New Source: Hubplanner #12145
Conversation
I still need to add integration and unit tests, but I just wanted to open the PR first |
@marcosmarxm what is a good example of unit/integration test suite comparable to Hubplanner? Looks like some connectors implement tests and others don't, so just want to know what is best to compare against and structure mine |
def test_check_connection(mocker): | ||
source = SourceHubplanner() | ||
logger_mock, config_mock = MagicMock(), MagicMock() | ||
assert source.check_connection(logger_mock, config_mock) == (True, None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@marcosmarxm for example, I am a little confused how I am supposed to set this up to pass. All the other connectors look like they are setting up fixtures that just have like "api_key": "test_api_key"
as their config. I don't understand why something like that would pass without a valid config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The goal of this test is to assert the behavior of check_connection on successful or failed connection response by the API. You should use request_mock
to forge mock success and failure request and assert on the behavior of check_connection
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alafanechere so I would copy basically an example of a "failed response" from the hubplanner API, set up a test to mock that as the response, and make sure that check_connection
fails in that instance?
Hi @RickRen7575 thank you for this contribution. We need to create a sandbox Hubplanner account to run tests on your connectors. I'll go for a review once we have this account. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please:
- Format your code with
./gradlew format
- Run the acceptance tests and share their output:
./gradlew :airbyte-integrations:connectors:source-hubplanner:integrationTest
(this is a built-in test suite that is configured inacceptance-test-config.yml
)
That would be awesome!! |
@RickRen7575 are you ready to perform these tasks? I won't be able to do this myself as I've no maintainer permission on your organization's fork. |
Hey @RickRen7575, |
@alafanechere sorry for the delay - I've been out for the last 3 weeks. I'll run these things and then push updates! |
@alafanechere I don't see the ability to reopen this PR. Do you mind doing that on your end? |
@RickRen7575 I reopened it! |
@alafanechere I just tried running the integration tests and got this output:
|
Are you using WSL to run this? Could you check the alternative |
I was trying to use just straight up Windows, but I can try WSL instead! |
@RickRen7575 do you manage to make the test pass with WSL? |
Hi @alafanechere I'm sorry but I've just been swamped recently. I hope I can get back on this soon. I tried running the tests and ran into an issue and then got sidetracked. |
Thanks for the contribution @RickRen7575 I merged the code in #15521 |
@marcosmarxm oh great! |
What
I added a source connector for the Hubplanner API. Here is the information on the Hubplanner API: https://github.com/hubplanner/API
How
I utilized the generate.sh script to provide a scaffold and then followed the YouTube video here: https://www.youtube.com/watch?v=kJ3hLoNfz_E&list=PLgyvStszwUHjb-t_wfGizz1VZgwX7Td5b&index=2
I also took inspiration from the Singer tap for Hubplanner: https://github.com/rangle/tap-hubplanner
Recommended reading order
Anything in the source-hubplanner directory should be fair game to start at.
馃毃 User Impact 馃毃
No breaking changes.
Pre-merge Checklist
Expand the relevant checklist and delete the others.
New Connector
Community member or Airbyter
Community member
airbyte_secret
./gradlew :airbyte-integrations:connectors:<name>:integrationTest
.README.md
bootstrap.md
. See description and examplesdocs/SUMMARY.md
docs/integrations/<source or destination>/<name>.md
including changelog. See changelog exampledocs/integrations/README.md
airbyte-integrations/builds.md
Airbyter
If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.
/test connector=connectors/<name>
command is passing/publish
command described hereUpdating a connector
Community member or Airbyter
airbyte_secret
./gradlew :airbyte-integrations:connectors:<name>:integrationTest
.README.md
bootstrap.md
. See description and examplesdocs/integrations/<source or destination>/<name>.md
including changelog. See changelog exampleAirbyter
If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.
/test connector=connectors/<name>
command is passing/publish
command described hereConnector Generator
-scaffold
in their name) have been updated with the latest scaffold by running./gradlew :airbyte-integrations:connector-templates:generator:testScaffoldTemplates
then checking in your changesTests
Unit
Put your unit tests output here.
Integration
Put your integration tests output here.
Acceptance
I tested running
check
,discover
, andread
commands with theconfigured_catalog.json
file provided, and it worked. I also tested creating the source in the UI and creating a connection that loads Hubplanner data to BigQuery and I also tested loading to a local JSON file. Both worked!