-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Standard Tests: create modular standard test suite v2 scaffolding #2702
Conversation
@@ -0,0 +1,6 @@ | |||
connector_image: airbyte/source-hubspot:0.1.0 |
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.
How are we going to inject the version?
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.
to be honest I don't know, this way of configuring standard test suite was in original requirements,
@sherifnada please give me a hand here :)
offtopic: it is relatively easy to override tag/version from custom command-option (something like pytest --connector="airbyte/source-hubspot:0.1.0"
)
SOFTWARE. | ||
""" | ||
|
||
import setuptools |
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.
When do we move to poetry? :)
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.
well, poetry has some issues with dependencies specified as local relative paths (python-poetry/poetry#34)
we need to spend some time to investigate all pros and cons
airbyte-integrations/bases/standard-test/standard_test/config.py
Outdated
Show resolved
Hide resolved
from .utils import full_refresh_only_catalog, ConnectorRunner | ||
|
||
|
||
class TestBaseInterface: |
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.
Should we call it StandardTestBaseInterface ?
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.
Test
is a verb here.
nevertheless it was renamed to TestCore
to align with configuration file
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.
Very very exciting! 🎉 a lot of my comments can be addressed in follow up issues/separate PRs. There's a few comments that should be addressed before merging, but it's probably best to start separating new features/requests into different PRs.
airbyte-integrations/bases/standard-test/standard_test/standard_test.py
Outdated
Show resolved
Hide resolved
@@ -0,0 +1,55 @@ | |||
""" |
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.
maybe a clearer name for this file is config_models.py
? or put it in a models/configs.py
?
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.
but, I don't see why models
? this is configuration of standard_test
package 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.
right, it's the configuration's model. Model here just means the expected schema. This is not the actual config object. Another name is potentially spec
but model is more common
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.
but it is an actual config object. The fact that we use pydantic to simplify it deserialization is nice feature. There is no need to have extra class to have a configuration. You can check another typical usage of Config object in pydantic docs. Maybe I'm missing something here (too pythonic way of thinking...dunno), but I being using pydantic models as configs in all my projects without any extra layers on top of it.
airbyte-integrations/bases/standard-test/standard_test/config.py
Outdated
Show resolved
Hide resolved
airbyte-integrations/bases/standard-test/standard_test/config.py
Outdated
Show resolved
Hide resolved
airbyte-integrations/bases/standard-test/standard_test/conftest.py
Outdated
Show resolved
Hide resolved
airbyte-integrations/bases/standard-test/standard_test/standard_test.py
Outdated
Show resolved
Hide resolved
airbyte-integrations/bases/standard-test/standard_test/standard_test.py
Outdated
Show resolved
Hide resolved
airbyte-integrations/bases/standard-test/standard_test/standard_test.py
Outdated
Show resolved
Hide resolved
airbyte-integrations/bases/standard-test/standard_test/standard_test.py
Outdated
Show resolved
Hide resolved
airbyte-integrations/bases/standard-test/standard_test/conftest.py
Outdated
Show resolved
Hide resolved
spec_path: str = spec_path | ||
|
||
|
||
class ConnectionTestConfig(BaseModel): |
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 am confused about this config.
It seems every time we need to create a connection test, we need to test for both success and failure.
Why don't we have
config_path: str
success: bool
?
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.
updated, success
-> status
, where status is enum of succeed
, failed
, exception
* fixes and address comments from @sherifnada * fix tests * fix leaking of secrets in the output * fix package path * fix imports * hide secrets * fix logs * fix sequential read test * fix build * format Co-authored-by: Eugene Kulak <kulak.eugene@gmail.com>
Co-authored-by: Eugene Kulak <kulak.eugene@gmail.com>
closes #2180
What
Describe what the change is solving
It helps to add screenshots if it affects the frontend.
How this actually works
I tried to keep things simple and at the same time aligned with pytest way of doing things. The latter allow us to override and/or extend behaviour by customizing fixtures in the code if needed, thuse our tests will have less surprises for people familiar with pytest.
To execute test I had two controversial approaches:
I choice the first approach because it requires less files.
The bread and butter of this
framework
is fixture. Each test suite has set of inputs, multiple sets will result in parameterized test suite. The fixture calledinputs
represents such set of inputs, its value depends on which test suits we execute at the moment and the content of the config file.typical config file:
Pre-merge Checklist
Recommended reading order
test.java
component.ts