Skip to content

Commit

Permalink
Add more tests
Browse files Browse the repository at this point in the history
Signed-off-by: Sayali Gaikawad <gaiksaya@amazon.com>
  • Loading branch information
gaiksaya committed Oct 7, 2024
1 parent a1e4422 commit 6ba39fd
Show file tree
Hide file tree
Showing 8 changed files with 346 additions and 123 deletions.
5 changes: 3 additions & 2 deletions src/jenkins/ComponentBuildStatus.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ class ComponentBuildStatus {
]
]
def query = JsonOutput.toJson(queryMap)
this.script.println(query.replace('"', '\\"'))
return query.replace('"', '\\"')
}

Expand All @@ -137,8 +138,8 @@ class ComponentBuildStatus {
return components
}

def getLatestDistributionBuildNumber(String version) {
def jsonResponse = this.openSearchMetricsQuery.fetchMetrics(getQuery(getLatestDistributionBuildNumberQuery))
def getLatestDistributionBuildNumber() {
def jsonResponse = this.openSearchMetricsQuery.fetchMetrics(getLatestDistributionBuildNumberQuery())
def latestDistributionBuildNumber = jsonResponse.hits.hits[0]._source.distribution_build_number
return latestDistributionBuildNumber
}
Expand Down
4 changes: 2 additions & 2 deletions src/utils/OpenSearchMetricsQuery.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

package utils

import groovy.json.JsonSlurper
import groovy.json.JsonSlurperClassic

class OpenSearchMetricsQuery {
String metricsUrl
Expand Down Expand Up @@ -37,6 +37,6 @@ class OpenSearchMetricsQuery {
""",
returnStdout: true
).trim()
return new JsonSlurper().parseText(response)
return new JsonSlurperClassic().parseText(response)
}
}
189 changes: 96 additions & 93 deletions tests/jenkins/TestPublishIntegTestResults.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -65,100 +65,103 @@ class TestPublishIntegTestResults extends BuildPipelineTest {
def expectedCommandBlock = '''set +e
set +x
echo "INDEX NAME IS test-index"
INDEX_MAPPING='{
"mappings": {
"properties": {
"component": {
"type": "keyword"
},
"component_repo": {
"type": "keyword"
},
"component_repo_url": {
"type": "keyword"
},
"version": {
"type": "keyword"
},
"integ_test_build_number": {
"type": "integer"
},
"integ_test_build_url": {
"type": "keyword"
},
"distribution_build_number": {
"type": "integer"
},
"distribution_build_url": {
"type": "keyword"
},
"build_start_time": {
"type": "date",
"format": "epoch_millis"
},
"rc": {
"type": "keyword"
},
"rc_number": {
"type": "integer"
},
"platform": {
"type": "keyword"
},
"architecture": {
"type": "keyword"
},
"distribution": {
"type": "keyword"
},
"component_category": {
"type": "keyword"
},
"component_build_result": {
"type": "keyword"
},
"test_report_manifest_yml": {
"type": "keyword"
},
"with_security": {
"type": "keyword"
},
"with_security_build_yml": {
"type": "keyword"
},
"with_security_cluster_stdout": {
"type": "keyword"
},
"with_security_test_stdout": {
"type": "keyword"
},
"with_security_cluster_stderr": {
"type": "keyword"
},
"with_security_test_stderr": {
"type": "keyword"
},
"without_security": {
"type": "keyword"
},
"without_security_build_yml": {
"type": "keyword"
},
"without_security_cluster_stdout": {
"type": "keyword"
},
"without_security_test_stdout": {
"type": "keyword"
},
"without_security_cluster_stderr": {
"type": "keyword"
},
"without_security_test_stderr": {
"type": "keyword"
INDEX_MAPPING='{
"mappings": {
"properties": {
"component": {
"type": "keyword"
},
"component_repo": {
"type": "keyword"
},
"component_repo_url": {
"type": "keyword"
},
"version": {
"type": "keyword"
},
"integ_test_build_number": {
"type": "integer"
},
"integ_test_build_url": {
"type": "keyword"
},
"distribution_build_number": {
"type": "integer"
},
"distribution_build_url": {
"type": "keyword"
},
"build_start_time": {
"type": "date",
"format": "epoch_millis"
},
"rc": {
"type": "keyword"
},
"rc_number": {
"type": "integer"
},
"platform": {
"type": "keyword"
},
"architecture": {
"type": "keyword"
},
"distribution": {
"type": "keyword"
},
"component_category": {
"type": "keyword"
},
"component_build_result": {
"type": "keyword"
},
"test_report_manifest_yml": {
"type": "keyword"
},
"with_security": {
"type": "keyword"
},
"with_security_build_yml": {
"type": "keyword"
},
"with_security_cluster_stdout": {
"type": "keyword"
},
"with_security_test_stdout": {
"type": "keyword"
},
"with_security_cluster_stderr": {
"type": "keyword"
},
"with_security_test_stderr": {
"type": "keyword"
},
"without_security": {
"type": "keyword"
},
"without_security_build_yml": {
"type": "keyword"
},
"without_security_cluster_stdout": {
"type": "keyword"
},
"without_security_test_stdout": {
"type": "keyword"
},
"without_security_cluster_stderr": {
"type": "keyword"
},
"without_security_test_stderr": {
"type": "keyword"
}
},
"aliases": {
"opensearch-integration-test-results": {}
}
}
}
}
}'
}'
curl -I "METRICS_HOST_URL/test-index" --aws-sigv4 "aws:amz:us-east-1:es" --user "null:null" -H "x-amz-security-token:null" | grep -E "HTTP\\/[0-9]+(\\.[0-9]+)? 200"
if [ $? -eq 0 ]; then
echo "Index already exists. Indexing Results"
Expand Down
Loading

0 comments on commit 6ba39fd

Please sign in to comment.