-
Notifications
You must be signed in to change notification settings - Fork 25
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
Creating Issue Reports for Flaky Test Failures in Gradle Check #436
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package gradlecheck | ||
|
||
class CreateMarkDownTable { | ||
String failedTest | ||
ArrayList<String> tableData | ||
ArrayList<String> additionalPullRequests | ||
|
||
CreateMarkDownTable(String failedTest, List<Map<String, Object>> tableData, List<String> additionalPullRequests) { | ||
this.failedTest = failedTest | ||
this.tableData = tableData | ||
this.additionalPullRequests = additionalPullRequests | ||
} | ||
|
||
def createMarkdownTable() { | ||
|
||
def tableHeader = """ | ||
## Flaky Test Report for `${this.failedTest}` | ||
|
||
Noticed the `${this.failedTest}` has some flaky, failing tests that failed during **post-merge actions**. | ||
|
||
### Details | ||
|
||
| Git Reference | Merged Pull Request | Build Details | Test Name | | ||
|---------------|----------------------|---------------|-----------| | ||
""" | ||
def tableRows = this.tableData.collect { row -> | ||
"| ${row.gitReference} | ${row.pullRequestLink} | ${row.buildDetailLink} | ${row.testNames.join('<br><br>')} |" | ||
}.join("\n") | ||
|
||
def additionalPRSection = """ | ||
\nThe other pull requests, besides those involved in post-merge actions, that contain failing tests with the `${this.failedTest}` class are: | ||
|
||
${this.additionalPullRequests.collect { pr -> "- [${pr}](https://github.com/opensearch-project/OpenSearch/pull/${pr})" }.join('\n')} | ||
|
||
For more details on the failed tests refer to [OpenSearch Gradle Check Metrics](https://metrics.opensearch.org/_dashboards/app/dashboards#/view/e5e64d40-ed31-11ee-be99-69d1dbc75083) dashboard. | ||
""" | ||
|
||
return tableHeader + tableRows + additionalPRSection | ||
} | ||
|
||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package gradlecheck | ||
|
||
import groovy.json.JsonOutput | ||
import gradlecheck.OpenSearchMetricsQuery | ||
|
||
class FetchPostMergeFailedTestClass { | ||
String metricsUrl | ||
String awsAccessKey | ||
String awsSecretKey | ||
String awsSessionToken | ||
def script | ||
|
||
FetchPostMergeFailedTestClass(String metricsUrl, String awsAccessKey, String awsSecretKey, String awsSessionToken, def script) { | ||
this.metricsUrl = metricsUrl | ||
this.awsAccessKey = awsAccessKey | ||
this.awsSecretKey = awsSecretKey | ||
this.awsSessionToken = awsSessionToken | ||
this.script = script | ||
} | ||
|
||
def getQuery() { | ||
def queryMap = [ | ||
size: 200, | ||
query: [ | ||
bool: [ | ||
must: [ | ||
[ | ||
match: [ | ||
"invoke_type.keyword": [ | ||
query: "Post Merge Action", | ||
operator: "OR", | ||
prefix_length: 0, | ||
max_expansions: 50, | ||
fuzzy_transpositions: true, | ||
lenient: false, | ||
zero_terms_query: "NONE", | ||
auto_generate_synonyms_phrase_query: true, | ||
boost: 1 | ||
] | ||
] | ||
], | ||
[ | ||
match: [ | ||
test_status: [ | ||
query: "FAILED", | ||
operator: "OR" | ||
] | ||
] | ||
] | ||
] | ||
] | ||
], | ||
aggregations: [ | ||
test_class_keyword_agg: [ | ||
terms: [ | ||
field: "test_class", | ||
size: 500 | ||
] | ||
] | ||
] | ||
] | ||
|
||
def query = JsonOutput.toJson(queryMap) | ||
return query.replace('"', '\\"') | ||
} | ||
|
||
def getPostMergeFailedTestClass() { | ||
def jsonResponse = new OpenSearchMetricsQuery(metricsUrl,awsAccessKey, awsSecretKey, awsSessionToken, script).fetchMetrics(getQuery()) | ||
def keys = jsonResponse.aggregations.test_class_keyword_agg.buckets.collect { it.key } | ||
return keys | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package gradlecheck | ||
|
||
import groovy.json.JsonOutput | ||
import gradlecheck.OpenSearchMetricsQuery | ||
|
||
class FetchPostMergeFailedTestName { | ||
String metricsUrl | ||
String awsAccessKey | ||
String awsSecretKey | ||
String awsSessionToken | ||
def script | ||
|
||
FetchPostMergeFailedTestName(String metricsUrl, String awsAccessKey, String awsSecretKey, String awsSessionToken, def script) { | ||
this.metricsUrl = metricsUrl | ||
this.awsAccessKey = awsAccessKey | ||
this.awsSecretKey = awsSecretKey | ||
this.awsSessionToken = awsSessionToken | ||
this.script = script | ||
} | ||
|
||
def getQuery(testName, gitReference) { | ||
def queryMap = [ | ||
size: 200, | ||
query: [ | ||
bool: [ | ||
must: [ | ||
[ | ||
match: [ | ||
"invoke_type.keyword": [ | ||
query: "Post Merge Action", | ||
operator: "OR", | ||
prefix_length: 0, | ||
max_expansions: 50, | ||
fuzzy_transpositions: true, | ||
lenient: false, | ||
zero_terms_query: "NONE", | ||
auto_generate_synonyms_phrase_query: true, | ||
boost: 1 | ||
] | ||
] | ||
], | ||
[ | ||
match: [ | ||
test_status: [ | ||
query: "FAILED", | ||
operator: "OR", | ||
prefix_length: 0, | ||
max_expansions: 50, | ||
fuzzy_transpositions: true, | ||
lenient: false, | ||
zero_terms_query: "NONE", | ||
auto_generate_synonyms_phrase_query: true, | ||
boost: 1 | ||
] | ||
] | ||
], | ||
[ | ||
match: [ | ||
test_class: [ | ||
query: testName, | ||
operator: "OR", | ||
prefix_length: 0, | ||
max_expansions: 50, | ||
fuzzy_transpositions: true, | ||
lenient: false, | ||
zero_terms_query: "NONE", | ||
auto_generate_synonyms_phrase_query: true, | ||
boost: 1 | ||
] | ||
] | ||
], | ||
[ | ||
match: [ | ||
"git_reference.keyword": [ | ||
query: gitReference, | ||
operator: "OR", | ||
prefix_length: 0, | ||
max_expansions: 50, | ||
fuzzy_transpositions: true, | ||
lenient: false, | ||
zero_terms_query: "NONE", | ||
auto_generate_synonyms_phrase_query: true, | ||
boost: 1 | ||
] | ||
] | ||
] | ||
], | ||
adjust_pure_negative: true, | ||
boost: 1 | ||
] | ||
], | ||
aggregations: [ | ||
test_name_keyword_agg: [ | ||
terms: [ | ||
field: "test_name", | ||
size: 500 | ||
] | ||
], | ||
build_number_agg: [ | ||
terms: [ | ||
field: "build_number", | ||
size: 500 | ||
] | ||
], | ||
pull_request_agg: [ | ||
terms: [ | ||
field: "pull_request", | ||
size: 500 | ||
] | ||
] | ||
] | ||
] | ||
|
||
def query = JsonOutput.toJson(queryMap) | ||
return query.replace('"', '\\"') | ||
|
||
} | ||
def getPostMergeFailedTestName(testName, gitReference) { | ||
return new OpenSearchMetricsQuery(metricsUrl, awsAccessKey, awsSecretKey, awsSessionToken, script).fetchMetrics(getQuery(testName, gitReference)) | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
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.
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.
except markdown class, every class has the same constructor and
get_query
methods. Would it be better to have a parent/super class or interface, if supported in groovy class, and have these method defined there and other classes just inherit it and implement in its own way. Method likegetPostMergeFailedTestClass
can have a generic name and implemented in all the sub-classes.Not a blocker for me.
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.
That was my initial implementation rishab, check this commit which has the
extends
andsuper
implementation, the jenkins pipeline works but thisextends
andsuper
implementation ran into issues with running the tests (both old and new tests part of the PR) part of this repo, please check my comment here.