-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Add support of TEST_TAGS in python tests #17075
Conversation
Add a `tag(tag)` decorator that skips a test if the tag is not included in the comma-separated list of `TEST_TAGS` environment variable. This offers an initial support for the similar implementation added for mage in elastic#16937.
Pinging @elastic/integrations (Team:Integrations) |
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.
Looks good
@@ -139,3 +140,26 @@ def parameterized_with_supported_versions(base_class): | |||
variants = supported_versions(versions_path) | |||
decorator = parameterized_class(['COMPOSE_ENV'], variants) | |||
decorator(base_class) | |||
|
|||
|
|||
def tag(tag): |
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 then used with @metricbeat.tag
?
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.
Yes, you need to import metricbeat
for that, but I think we do it in all metricbeat tests.
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, you need to pass a tag as parameter, e.g:
@metricbeat.tag('oracle')
def test_something(self):
...
@sayden could you take another look after moving the code to libbeat? Thanks! |
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.
LGTM
Add a `tag(tag)` decorator that skips a test if the tag is not included in the comma-separated list of `TEST_TAGS` environment variable. This offers an initial support for the similar implementation added for mage in elastic#16937. (cherry picked from commit 3bf05f5)
What does this PR do?
Add a
tag(tag)
decorator that skips a test if the tag is not includedin the comma-separated list of
TEST_TAGS
environment variable.This offers an initial support for the similar implementation added for
mage in #16937.
Why is it important?
#16937 was intended for cloud tests, where we only have go-based
integration tests. But we have found similar needings in some services
like oracle, where we need an image that we cannot distribute. In that
case we need a similar approach to run the test only in our Jenkins
instances, where the image is available.
Checklist
I have made corresponding changes to the documentationI have made corresponding change to the default configuration filesI have added tests that prove my fix is effective or that my feature worksHow to test this PR locally
@metricbeat.tag('sometag')
.TEST_TAGS
is not used.TEST_TAGS
environment variable includessometag
(e.g:TEST_TAGS=sometag
orTEST_TAGS=sometag,foo
.Related issues
Use cases