refactor: remove a11y tests setup (#29813)

This commit is contained in:
Aarif
2022-02-15 18:56:34 +05:00
committed by GitHub
parent 649a66de4e
commit aa31f3b255
117 changed files with 1 additions and 21424 deletions

View File

@@ -1,177 +0,0 @@
def runBokchoyTests() {
// Determine git refspec, branch, and clone type
git_shallow_clone = true
if (env.ghprbActualCommit) {
git_branch = "${ghprbActualCommit}"
git_refspec = "+refs/pull/${ghprbPullId}/*:refs/remotes/origin/pr/${ghprbPullId}/*"
} else {
git_branch = "${BRANCH_NAME}"
git_refspec = "+refs/heads/${BRANCH_NAME}:refs/remotes/origin/${BRANCH_NAME}"
}
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"]]]
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: 'reports/bok_choy/*.coverage*,test_root/log/**/*.log,test_root/log/**/*.png,reports/bok_choy/**/xunit.xml'
junit '**/reports/bok_choy/**/xunit.xml'
sendSplunkFile excludes: '', includes: '**/timing*.log', sizeLimit: '10MB'
}
def shardCount = 25
pipeline {
agent { label "jenkins-worker" }
options {
sendSplunkConsoleLog()
timestamps()
timeout(60)
}
environment {
WTW_CONTEXT = "bokchoy"
}
stages {
stage('Mark build as pending on Github') {
when {
// Only run github-build-status for master builds
expression { env.ghprbActualCommit == null }
}
steps {
script {
commit_sha = sh(returnStdout: true, script: 'git rev-parse HEAD').trim()
build job: 'github-build-status',
parameters: [
string(name: 'GIT_SHA', value: commit_sha),
string(name: 'GITHUB_ORG', value: 'edx'),
string(name: 'GITHUB_REPO', value: "${REPO_NAME}"),
string(name: 'TARGET_URL', value: "${BUILD_URL}"),
string(name: 'DESCRIPTION', value: 'Pending'),
string(name: 'CONTEXT', value: "${GITHUB_CONTEXT}"),
string(name: 'CREATE_DEPLOYMENT', value: 'false'),
string(name: 'BUILD_STATUS', value: 'pending')
],
propagate: false, wait: false
}
}
}
stage("Run tests") {
steps {
script {
def parallel_stages = [:]
for (int i = 1; i <= shardCount; i++) {
int index = i
parallel_stages["${index}"] = {
node('jenkins-worker') {
withEnv(["SHARD=${index}","TEST_SUITE=bok-choy"]) {
try {
stage("Bokchoy shard: ${index}") {
runBokchoyTests()
}
} finally {
bokchoyTestCleanup()
}
}
}
}
}
parallel parallel_stages
}
}
}
stage("Combine Coverage") {
when {
// Only combine coverage during context-collection
environment name: 'COLLECT_WHO_TESTS_WHAT', value: 'true'
}
steps {
script {
sshagent(credentials: ['jenkins-worker'], ignoreMissing: true) {
try {
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
"""
} finally {
archiveArtifacts allowEmptyArchive: true, artifacts: 'reports/*.coverage'
sendSplunkFile excludes: '', includes: '**/timing*.log', sizeLimit: '10MB'
}
}
}
}
}
}
post {
always {
script {
if (env.ghprbPullId != null) {
// For PR jobs, run the edx-platform-test-notifier for PR reporting
build job: 'edx-platform-test-notifier', parameters: [string(name: 'REPO', value: "${REPO_NAME}"), string(name: 'PR_NUMBER', value: "${ghprbPullId}")], wait: false
} else {
// For master jobs run github-build-status and report to slack when necessary
if (currentBuild.currentResult == "SUCCESS") {
create_deployment = "true"
build_status = "success"
build_description = "Build Passed"
}
else {
create_deployment = "false"
build_status = "failure"
build_description = "Build Failed"
}
commit_sha = sh(returnStdout: true, script: 'git rev-parse HEAD').trim()
build job: 'github-build-status',
parameters: [
string(name: 'GIT_SHA', value: commit_sha),
string(name: 'GITHUB_ORG', value: 'edx'),
string(name: 'GITHUB_REPO', value: "${REPO_NAME}"),
string(name: 'TARGET_URL', value: "${BUILD_URL}"),
string(name: 'DESCRIPTION', value: build_description),
string(name: 'CONTEXT', value: "${GITHUB_CONTEXT}"),
string(name: 'CREATE_DEPLOYMENT', value: create_deployment),
string(name: 'BUILD_STATUS', value: build_status)
],
propagate: false, wait: false
if (currentBuild.currentResult != "SUCCESS"){
slackSend botUser: true,
message: "`${JOB_NAME}` #${BUILD_NUMBER}: ${currentBuild.currentResult} after ${currentBuild.durationString.replace(' and counting', '')}\n${BUILD_URL}"
email_body = "See: <${BUILD_URL}>\n\nChanges:\n"
change_sets = currentBuild.changeSets
for (int j = 0; j < change_sets.size(); j++) {
change_set_items = change_sets[j].items
for (int k = 0; k < change_set_items.length; k++) {
item = change_set_items[k]
email_body = email_body + "\n Commit: ${item.commitId} by ${item.author}: ${item.msg}"
}
}
emailext body: email_body,
subject: "Build failed in Jenkins: ${JOB_NAME} #${BUILD_NUMBER}", to: 'testeng@edx.org'
} else if (currentBuild.currentResult == "SUCCESS" && currentBuild.previousBuild.currentResult != "SUCCESS") {
slackSend botUser: true,
message: "`${JOB_NAME}` #${BUILD_NUMBER}: Back to normal after ${currentBuild.durationString.replace(' and counting', '')}\\n${BUILD_URL}"
emailext body: "See <${BUILD_URL}>",
subject: "Jenkins Build is back to normal: ${JOB_NAME} #${BUILD_NUMBER}", to: 'testeng@edx.org'
}
}
}
}
}
}

View File

@@ -1,34 +0,0 @@
#!/usr/bin/env bash
set -e
###############################################################################
#
# accessibility-tests.sh
#
# Execute the accessibility tests for edx-platform.
#
# If the optional `TOX_ENV` environment variable is defined, it
# specifies which version of Python and Django should be installed when
# running the tests inside a `tox` virtualenv. If undefined, the tests are
# run using the currently active Python environment. For more information
# on what versions are supported, check the tox.ini file.
#
###############################################################################
echo "Setting up for accessibility tests..."
source scripts/jenkins-common.sh
# if specified tox environment is supported, prepend paver commands
# with tox env invocation
if [ -z ${TOX_ENV+x} ] || [[ ${TOX_ENV} == 'null' ]]; then
TOX=""
elif tox -l |grep -q "${TOX_ENV}"; then
TOX="tox -r -e ${TOX_ENV} --"
else
echo "${TOX_ENV} is not currently supported. Please review the"
echo "tox.ini file to see which environments are supported"
exit 1
fi
echo "Running explicit accessibility tests..."
SELENIUM_BROWSER=chrome BOKCHOY_HEADLESS=true $TOX paver test_a11y

View File

@@ -49,7 +49,6 @@ set -e
# Note that you will still need to pass a value for 'TEST_SUITE'
# or else no tests will be executed.
SHARD=${SHARD:="all"}
NUMBER_OF_BOKCHOY_THREADS=${NUMBER_OF_BOKCHOY_THREADS:=1}
# Clean up previous builds
git clean -qxfd
@@ -180,46 +179,4 @@ case "$TEST_SUITE" in
# which is considered successful.
exit $EXIT
;;
"bok-choy")
PAVER_ARGS="-n $NUMBER_OF_BOKCHOY_THREADS"
if [[ -n "$FILTER_WHO_TESTS_WHAT" ]]; then
PAVER_ARGS="$PAVER_ARGS --with-wtw=origin/master"
fi
if [[ -n "$COLLECT_WHO_TESTS_WHAT" ]]; then
PAVER_ARGS="$PAVER_ARGS --pytest-remote-contexts --coveragerc=common/test/acceptance/.coveragerc"
fi
export BOKCHOY_HEADLESS=true
case "$SHARD" in
"all")
$TOX paver test_bokchoy $PAVER_ARGS
;;
[1-9]|1[0-9]|2[0-4])
$TOX paver test_bokchoy --eval-attr="shard==$SHARD and not a11y" $PAVER_ARGS
;;
25|"noshard")
$TOX paver test_bokchoy --eval-attr="(not shard or shard>=$SHARD) and not a11y" $PAVER_ARGS
;;
# Default case because if we later define another bok-choy shard on Jenkins
# (e.g. Shard 10) in the multi-config project and expand this file
# with an additional case condition, old branches without that commit
# would not execute any tests on the worker assigned to that shard
# and thus their build would fail.
# This way they will just report 1 test executed and passed.
*)
# Need to create an empty test result so the post-build
# action doesn't fail the build.
# May be unnecessary if we changed the "Skip if there are no test files"
# option to True in the jenkins job definitions.
mkdir -p reports/bok_choy
emptyxunit "bok_choy/xunit"
;;
esac
;;
esac

View File

@@ -65,15 +65,6 @@ _paver()
return 0
fi
;;
test_bokchoy)
_test_bokchoy_args
if [[ -n $COMPREPLY ]]
then
return 0
fi
;;
*)
;;
esac
if [[ ${#COMP_WORDS[*]} == 3 ]]
@@ -113,27 +104,6 @@ _test_system_args()
esac
}
_test_bokchoy_args()
{
local bokchoy_tests cur prev
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD - 1]}"
case "$prev" in
-d|--test_dir)
bokchoy_tests=`find common/test/acceptance -name \*.py| sed 's:common/test/acceptance/::'`
COMPREPLY=( $(compgen -o filenames -W "$bokchoy_tests" -- $cur) )
return 0
;;
-t|--test_spec)
bokchoy_tests=`find common/test/acceptance/tests -name \*.py| sed 's:common/test/acceptance/::'`
COMPREPLY=( $(compgen -o filenames -W "$bokchoy_tests" -- $cur) )
return 0
;;
*)
;;
esac
}
# Assign the auto-completion function for our command.
complete -F _paver -o default paver