aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Alexander <obviousrebel@users.noreply.github.com>2019-05-01 15:56:07 -0400
committerMatt Rendina <rendinam@users.noreply.github.com>2019-05-01 15:56:07 -0400
commitdc7160a449cd98b7e5ed368746313358cc3ff2a8 (patch)
tree77dc63cabe8ed491bc64da9d0be91b9631e12c4c
parent78ca85cfe63998b47a1b15346fee93ec59057cbf (diff)
downloadjscu_refactor-dc7160a449cd98b7e5ed368746313358cc3ff2a8.tar.gz
XML Ingestion Fixes (#46)1.3.12
* fix junit xml ingestion * updated pytest paths * removed pytest pin * added invalid test report * removed library directive * removed validate function
-rw-r--r--Jenkinsfile6
-rw-r--r--invalid_report.xml13
-rw-r--r--vars/utils.groovy27
3 files changed, 31 insertions, 15 deletions
diff --git a/Jenkinsfile b/Jenkinsfile
index 69b246a..1a7ff4c 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -33,12 +33,12 @@ bc0.env_vars = ['VAR_ONE=1',
'VAR_TWO=2']
bc0.conda_ver = '4.6.4'
bc0.conda_packages = ['python=3.6',
- 'pytest=3.8.2']
+ 'pytest']
bc0.build_cmds = ["date",
"./access_env_var.sh",
"which python",
"conda install ipython"]
-bc0.test_cmds = ["${PYTEST} test_75pass.py"]
+bc0.test_cmds = ["${PYTEST} tests/test_75pass.py"]
bc0.test_configs = [data_config]
@@ -46,7 +46,7 @@ bc1 = utils.copy(bc0)
bc1.name = 'Second'
bc1.env_vars = ['VAR_THREE=3',
'VAR_FOUR=4']
-bc1.test_cmds[1] = "${PYTEST} test_25pass.py"
+bc1.test_cmds[1] = "${PYTEST} tests/test_25pass.py"
bc2 = utils.copy(bc0)
diff --git a/invalid_report.xml b/invalid_report.xml
new file mode 100644
index 0000000..b9abbf2
--- /dev/null
+++ b/invalid_report.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<invalid>
+</invalid>
+<testsuite errors="0" failures="0" invalid-param="" name="pytest" skipped="0" tests="5" time="0.042">
+ <testcase classname="tests.test_invalid" name="test_1" time="0.001"></testcase>
+ <testcase classname="tests.test_invalid" name="test_2" time="0.001">
+ <invalid-tag>
+ </invalid-tag>
+ </testcase>
+ <testcase invalid-testcase="" classname="tests.test_invalid" name="test_3" time="0.001"></testcase>
+ <testcase classname="tests.test_invalid" name="test_4" time="0.001"></testcase>
+ <testcase classname="tests.test_invalid" name="test_5" time="0.001"></testcase>
+</testsuite>
diff --git a/vars/utils.groovy b/vars/utils.groovy
index 8a7c00e..4081980 100644
--- a/vars/utils.groovy
+++ b/vars/utils.groovy
@@ -45,7 +45,7 @@ def postGithubIssue(reponame, username, password, subject, message) {
// @param args Map containing entries for control of Setup stage.
//
// @return skip_job int Status of clone step, to be tested to determine
-// need to abort from Jenkinsfile.
+// need to abort from Jenkinsfile.
def scm_checkout(args = ['skip_disable':false]) {
skip_job = 0
node('master') {
@@ -169,7 +169,7 @@ def parseTestReports(buildconfigs) {
def raw_totals = ''
def totals = [:]
def tinfo = new testInfo()
- tinfo.subject = "[AUTO] Regression testing summary"
+ tinfo.subject = "[AUTO] Regression testing summary"
tinfo.message = "Regression Testing (RT) Summary:\n\n"
for (config in buildconfigs) {
println("Unstashing test report for: ${config.name}")
@@ -247,7 +247,7 @@ upload_spec = """
// collected from each build configuration execution and post this message
// as an issue on the the project's Github page.
//
-// @param jobconfig JobConfig object
+// @param jobconfig JobConfig object
def testSummaryNotify(jobconfig, buildconfigs, test_info) {
//def test_info = parseTestReports(buildconfigs)
@@ -315,19 +315,23 @@ def publishCondaEnv(jobconfig, test_info) {
// @param config BuildConfig object
def processTestReport(config) {
def config_name = config.name
- report_exists = sh(script: "test -e *.xml", returnStatus: true)
+ report_exists = sh(script: "find *.xml", returnStatus: true)
def threshold_summary = "failedUnstableThresh: ${config.failedUnstableThresh}\n" +
"failedFailureThresh: ${config.failedFailureThresh}\n" +
"skippedUnstableThresh: ${config.skippedUnstableThresh}\n" +
"skippedFailureThresh: ${config.skippedFailureThresh}"
println(threshold_summary)
- // Process the XML results file to include the build config name as a prefix
+ // Process the XML results files to include the build config name as a prefix
// on each test name to make it more obvious from where each result originates.
if (report_exists == 0) {
- repfile = sh(script:"find *.xml", returnStdout: true).trim()
- command = "cp '${repfile}' '${repfile}.modified'"
- sh(script:command)
+ // get all .xml files in root
+ repfiles = sh(script:"find \$(pwd) -name '*.xml' -maxdepth 1", returnStdout: true).split("\n")
+ for (String repfile : repfiles) {
+ // loop through files
+ command = "cp '${repfile}' '${repfile}.modified'"
+ sh(script:command)
+ }
sh(script:"sed -i 's/ name=\"/ name=\"[${config.name}] /g' *.xml.modified")
step([$class: 'XUnitBuilder',
thresholds: [
@@ -336,7 +340,6 @@ def processTestReport(config) {
[$class: 'FailedThreshold', unstableThreshold: "${config.failedUnstableThresh}"],
[$class: 'FailedThreshold', failureThreshold: "${config.failedFailureThresh}"]],
tools: [[$class: 'JUnitType', pattern: '*.xml.modified']]])
-
} else {
println("No .xml files found in workspace. Test report ingestion skipped.")
}
@@ -504,7 +507,7 @@ def buildAndTest(config) {
// Stash spec file for use on master node.
stash includes: '**/conda_env_dump*', name: "conda_env_dump_${config.name}", useDefaultExcludes: false
}
-
+
} // end withEnv
}
@@ -684,7 +687,7 @@ def run(configs, concurrent = true) {
buildconfigs.add(config)
}
}
-
+
// Loop over config objects passed in handling each accordingly.
buildconfigs.eachWithIndex { config, index ->
@@ -721,7 +724,7 @@ def run(configs, concurrent = true) {
} // end node
}
- } //end closure configs.eachWithIndex
+ } //end closure configs.eachWithIndex
if (concurrent == true) {
stage("Matrix") {