Separate bokchoy coverage files by shard

This commit is contained in:
Calen Pennington
2019-07-24 13:47:46 -04:00
parent a0e4adbaa5
commit 82c49f0db9
3 changed files with 35 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
[run]
data_file = reports/bok_choy/.coverage
data_file = reports/bok_choy/${TEST_SUITE}.coverage${SHARD}
source =
lms
cms

View File

@@ -322,14 +322,15 @@ def test(options, passthrough_options):
@needs('pavelib.prereqs.install_coverage_prereqs')
@cmdopts([
("compare-branch=", "b", "Branch to compare against, defaults to origin/master"),
("rcfile=", "c", "Coveragerc file to use, defaults to .coveragerc"),
])
@timed
def coverage():
def coverage(options):
"""
Build the html, xml, and diff coverage reports
"""
report_dir = Env.REPORT_DIR
rcfile = Env.PYTHON_COVERAGERC
rcfile = getattr(options.coverage, 'rcfile', Env.PYTHON_COVERAGERC)
combined_report_file = report_dir / '{}.coverage'.format(os.environ.get('TEST_SUITE', ''))

View File

@@ -14,14 +14,17 @@ def runBokchoyTests() {
noTags: true, shallow: true]], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'jenkins-worker',
refspec: git_refspec, url: "git@github.com:edx/${REPO_NAME}.git"]]]
sh 'bash scripts/all-tests.sh'
stash includes: 'reports/bok_choy/*coverage*', name: "${TEST_SUITE}-reports-${SHARD}", allowEmpty: true
}
}
def bokchoyTestCleanup() {
archiveArtifacts allowEmptyArchive: true, artifacts: 'test_root/log/**/*.log,test_root/log/**/*.png'
archiveArtifacts allowEmptyArchive: true, artifacts: 'reports/bok_choy/*.coverage*,test_root/log/**/*.log,test_root/log/**/*.png'
junit '**/reports/bok_choy/**/xunit.xml'
}
def shardCount = 25
pipeline {
agent { label "jenkins-worker" }
options {
@@ -56,7 +59,7 @@ pipeline {
steps {
script {
def parallel_stages = [:]
for (int i = 1; i <= 25; i++) {
for (int i = 1; i <= shardCount; i++) {
int index = i
parallel_stages["${index}"] = {
node('jenkins-worker') {
@@ -76,6 +79,32 @@ pipeline {
}
}
}
stage("Combine Coverage") {
when {
// Only combine coverage during context-collection
environment name: 'PYTEST_CONTEXTS', value: 'true'
}
steps {
script {
sshagent(credentials: ['jenkins-worker'], ignoreMissing: true) {
checkout changelog: false, poll: false, scm: [$class: 'GitSCM', branches: [[name: git_branch]],
doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'CloneOption', honorRefspec: true,
noTags: true, shallow: true]], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'jenkins-worker',
refspec: git_refspec, url: "git@github.com:edx/${REPO_NAME}.git"]]]
for (int i = 1; i <= shardCount; i++) {
unstash "bok-choy-reports-${i}"
}
sh """
export TEST_SUITE=bok-choy
source scripts/jenkins-common.sh
paver coverage --rcfile=common/test/acceptance/.coveragerc
paver upload_coverage_to_s3
"""
}
}
}
}
}
post {
always {