-
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🎉 Source Looker: enable supporting of customer-hosted (self-hosted) instances #3587
Conversation
"pattern": ["^[a-zA-Z0-9._-]*\\.looker\\.com$"], | ||
"examples": ["domainname.looker.com"], | ||
"description": "Domain for your Looker account, e.g. airbyte.cloud.looker.com" | ||
"pattern": ["(^[a-zA-Z0-9._-]*\\.looker\\.com$)|(^looker\\.[a-zA-Z0-9._-]*\\.com$)|(^[0-9]+(?:\\.[0-9]+){3}(:[0-9]+)?$)"], |
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.
Why should the second pattern have looker in the name? It should just be any url right?
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.
I see looker.[yourdomain].com in the documentation.
https://docs.looker.com/setup-and-management/on-prem-install/installation#create_a_dns_record
If that's not the case , ill change to support any url
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.
I'm guessing that's more of a suggestion than a requirement. We can probably give that pattern in the examples array but not strictly require it.
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.
Also we shouldn't require .com
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 give me some examples so that i get clarity on how to write regex pattern
"description": "Domain for your Looker account, e.g. airbyte.cloud.looker.com" | ||
"pattern": [ | ||
"(^[a-zA-Z0-9._-]*\\.looker\\.com$)|(^[a-zA-Z0-9._-]*\\.[a-zA-Z0-9._-]*\\.[a-zA-Z0-9._-]*$)|(^[0-9]+(?:\\.[0-9]+){3}(:[0-9]+)?$)" | ||
], |
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 pattern needs to be checked. For example, the second group requires entry string dived at least by two dots. I think this is wrong. The third group has no segment length limitation.
"examples": ["domainname.looker.com"], | ||
"description": "Domain for your Looker account, e.g. airbyte.cloud.looker.com" | ||
"pattern": [ | ||
"(^[a-zA-Z0-9._-]*\\.looker\\.com$)|(^(?:[a-zA-Z0-9._-]*)?[a-zA-Z0-9._-]*\\.[a-zA-Z0-9._-]*$)|(^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(?::\\d{1,5})?$)" |
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.
can you create unit tests to verify this works? I'm not sure the second regex works as intended. I tested it on https://regex101.com/ with looker.airbyte.com
and it didn't work.
If it's too hard to pin down the regex then we can remove the pattern
entirely and rely on the check
operation to verify the domain is correct.
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.
(^(?:[a-zA-Z0-9._-]*)?[a-zA-Z0-9._-]*\\.[a-zA-Z0-9._-]*$)
-->pattern in spec.json
(^(?:[a-zA-Z0-9._-]*)?[a-zA-Z0-9._-]*\.[a-zA-Z0-9._-]*$)
--->pattern in python(used for testing in regexp101)
Did you try changing \\.
to \.
and then test it on regexp101. since '.' have special meaning ..we use \
as an escape character in python. But regexp pattern in spec.json file expects us to use \\
as an escape character. Same applies for matching the digits \d
in third pattern. Please find the snap below that matches several domains and let me know if any changes required:
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.
@Janardhanpoola hm, what about my.shiny.website.com:1234
?
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.
agree, please add a unit test for this.
import re | ||
import unittest | ||
|
||
def valid_URL(test_str): |
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.
do you know how we can avoid duplication and use regex from spec file here?
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.
I think may be we can access spec dict and can refer pattern using spec["properties"]["domain"]["pattern"]. I'm quite unsure of the imports here. can you point me an example here
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.
try to search @pytest.fixture
in our codebase, there will be plenty of examples
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.
Added @pytest.fixture
as suggested
|
||
|
||
|
||
class TestURLPattern(unittest.TestCase): |
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.
also we are trying to follow pytest-style tests, please check this for example how you can do it
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.
see comments
@@ -0,0 +1,44 @@ | |||
import re |
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.
Naming shall conform to PEP8 Naming Conventions.
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.
changed filename and tests as per pep8 standards
return result.group(0) | ||
|
||
@pytest.fixture | ||
def url(): |
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.
this is not what I meant, there is an example of parameterized tests on the page that I sent you.
You don't need to repeat the same test again and again
import re | ||
import pytest | ||
|
||
def valid_url(test_str): |
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.
also, this still does not prevents us from duplication. What will happen with this test if we decide to change the spec?
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.
you can check
airbyte/airbyte-integrations/connectors/source-freshdesk/integration_tests/test_client.py
Line 36 in e602133
@pytest.fixture(scope="session") |
for examples
"looker.clientname.com", | ||
"123.123.124.123:8000" | ||
], | ||
"description": "Domain for your Looker account, e.g. airbyte.cloud.looker.com,looker.[clientname].com,ip address" |
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.
"description": "Domain for your Looker account, e.g. airbyte.cloud.looker.com,looker.[clientname].com,ip address" | |
"description": "Domain for your Looker account, e.g. airbyte.cloud.looker.com, looker.[clientname].com, IP address" |
/test connector=source-looker
|
@vitaliizazmic make sure to format the PR name correctly |
/publish connector=connectors/source-looker
|
What
Adding support for self/customer hosted looker instance.(#3393)
How
Describe the solution
Pre-merge Checklist
Recommended reading order
test.java
component.ts