-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Prudhvi Godithi <[email protected]>
- Loading branch information
1 parent
225bdd4
commit c2536f3
Showing
15 changed files
with
1,230 additions
and
22 deletions.
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: 1 | ||
] | ||
] | ||
] | ||
] | ||
|
||
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.