Add support of TEST_TAGS in python tests#17075
Merged
Merged
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.
Contributor
|
Pinging @elastic/integrations (Team:Integrations) |
sayden
approved these changes
Mar 18, 2020
| decorator(base_class) | ||
|
|
||
|
|
||
| def tag(tag): |
Contributor
There was a problem hiding this comment.
This is then used with @metricbeat.tag?
Member
Author
There was a problem hiding this comment.
Yes, you need to import metricbeat for that, but I think we do it in all metricbeat tests.
Member
Author
There was a problem hiding this comment.
Well, you need to pass a tag as parameter, e.g:
@metricbeat.tag('oracle')
def test_something(self):
...
Member
Author
|
@sayden could you take another look after moving the code to libbeat? Thanks! |
jsoriano
added a commit
to jsoriano/beats
that referenced
this pull request
Mar 19, 2020
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)
5 tasks
This was referenced Mar 19, 2020
Merged
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_TAGSenvironment 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_TAGSis not used.TEST_TAGSenvironment variable includessometag(e.g:TEST_TAGS=sometagorTEST_TAGS=sometag,foo.Related issues
Use cases