spec: split coffeescript job
refs DE-128 Test Plan: 1. Ensure that the number of tests run per JS job is the same 2. Ensure that test reporting works correctly Change-Id: I0e7f3d37627a7d13d108cf562d001bcf41e2ea8a Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/242560 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Reviewed-by: Ryan Norton <rnorton@instructure.com> QA-Review: Aaron Ogata <aogata@instructure.com> Product-Review: Aaron Ogata <aogata@instructure.com>
This commit is contained in:
parent
6fde8fac6a
commit
a65d266b36
|
@ -20,6 +20,7 @@
|
|||
|
||||
library "canvas-builds-library"
|
||||
|
||||
def COFFEE_NODE_COUNT = 2
|
||||
def DEFAULT_NODE_COUNT = 1
|
||||
def JSG_NODE_COUNT = 3
|
||||
|
||||
|
@ -108,11 +109,15 @@ pipeline {
|
|||
sh 'build/new-jenkins/js/tests-quizzes.sh'
|
||||
}
|
||||
|
||||
for(int i = 0; i < COFFEE_NODE_COUNT; i++) {
|
||||
tests["Karma - Spec Group - coffee${i}"] = makeKarmaStage('coffee', i, COFFEE_NODE_COUNT)
|
||||
}
|
||||
|
||||
for(int i = 0; i < JSG_NODE_COUNT; i++) {
|
||||
tests["Karma - Spec Group - jsg${i}"] = makeKarmaStage('jsg', i, JSG_NODE_COUNT)
|
||||
}
|
||||
|
||||
['coffee', 'jsa', 'jsh'].each { group ->
|
||||
['jsa', 'jsh'].each { group ->
|
||||
tests["Karma - Spec Group - ${group}"] = makeKarmaStage(group, 0, DEFAULT_NODE_COUNT)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
import $ from 'jquery'
|
||||
import {extend, defer} from 'lodash'
|
||||
import RCELoader from 'jsx/shared/rce/serviceRCELoader'
|
||||
import SectionCollection from 'compiled/collections/SectionCollection'
|
||||
import Assignment from 'compiled/models/Assignment'
|
||||
import DueDateList from 'compiled/models/DueDateList'
|
||||
|
@ -96,6 +97,9 @@ QUnit.module('EditView', {
|
|||
fakeENV.setup()
|
||||
this.server = sinon.fakeServer.create({respondImmediately: true})
|
||||
sandbox.fetch.mock('path:/api/v1/courses/1/lti_apps/launch_definitions', 200)
|
||||
|
||||
RCELoader.RCE = null
|
||||
return RCELoader.loadRCE()
|
||||
},
|
||||
teardown() {
|
||||
this.server.restore()
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
import $ from 'jquery'
|
||||
import React from 'react'
|
||||
import _ from 'underscore'
|
||||
import RCELoader from 'jsx/shared/rce/serviceRCELoader'
|
||||
import SectionCollection from 'compiled/collections/SectionCollection'
|
||||
import Assignment from 'compiled/models/Assignment'
|
||||
import DueDateList from 'compiled/models/DueDateList'
|
||||
|
@ -124,6 +125,10 @@ QUnit.module('EditView', {
|
|||
})
|
||||
this.server = sinon.fakeServer.create()
|
||||
sandbox.fetch.mock('path:/api/v1/courses/1/lti_apps/launch_definitions', 200)
|
||||
|
||||
RCELoader.RCE = null
|
||||
|
||||
return RCELoader.loadRCE()
|
||||
},
|
||||
teardown() {
|
||||
this.server.restore()
|
||||
|
|
|
@ -28,8 +28,8 @@ const CONTEXT_COFFEESCRIPT_SPEC = 'spec/coffeescripts'
|
|||
const CONTEXT_EMBER_GRADEBOOK_SPEC = 'app/coffeescripts/ember'
|
||||
const CONTEXT_JSX_SPEC = 'spec/javascripts/jsx'
|
||||
|
||||
const RESOURCE_COFFEESCRIPT_SPEC = /Spec.(coffee|js)$/
|
||||
const RESOURCE_EMBER_GRADEBOOK_SPEC = /\.spec.js$/
|
||||
const RESOURCE_COFFEESCRIPT_SPEC = /Spec$/
|
||||
const RESOURCE_EMBER_GRADEBOOK_SPEC = /\.spec$/
|
||||
const RESOURCE_JSX_SPEC = /Spec$/
|
||||
|
||||
const RESOURCE_JSA_SPLIT_SPEC = /^\.\/[a-f].*Spec$/
|
||||
|
@ -103,8 +103,44 @@ if (process.env.JSPEC_GROUP) {
|
|||
}
|
||||
|
||||
if (process.env.JSPEC_GROUP === 'coffee') {
|
||||
let partitions = null
|
||||
|
||||
if (!isNaN(nodeIndex) && !isNaN(nodeTotal)) {
|
||||
const allFiles = []
|
||||
|
||||
getAllFiles(CONTEXT_COFFEESCRIPT_SPEC, allFiles, filePath => {
|
||||
const relativePath = filePath.replace(CONTEXT_COFFEESCRIPT_SPEC, '.').replace(/\.(coffee|js)$/, '')
|
||||
|
||||
return RESOURCE_COFFEESCRIPT_SPEC.test(relativePath) ? relativePath : null
|
||||
})
|
||||
|
||||
getAllFiles(CONTEXT_EMBER_GRADEBOOK_SPEC, allFiles, filePath => {
|
||||
const relativePath = filePath.replace(CONTEXT_EMBER_GRADEBOOK_SPEC, '.').replace(/\.(coffee|js)$/, '')
|
||||
|
||||
return RESOURCE_EMBER_GRADEBOOK_SPEC.test(relativePath) ? relativePath : null
|
||||
})
|
||||
|
||||
partitions = makeSortedPartitions(allFiles, nodeTotal)
|
||||
}
|
||||
|
||||
ignoreResource = (resource, context) => {
|
||||
return context.endsWith(CONTEXT_JSX_SPEC) && RESOURCE_JSX_SPEC.test(resource)
|
||||
return (
|
||||
(context.endsWith(CONTEXT_JSX_SPEC) && RESOURCE_JSX_SPEC.test(resource)) ||
|
||||
(
|
||||
partitions &&
|
||||
context.endsWith(CONTEXT_COFFEESCRIPT_SPEC) &&
|
||||
RESOURCE_COFFEESCRIPT_SPEC.test(resource) &&
|
||||
!isPartitionMatch(resource, partitions, nodeIndex)
|
||||
) ||
|
||||
(
|
||||
partitions &&
|
||||
context.endsWith(CONTEXT_EMBER_GRADEBOOK_SPEC) &&
|
||||
// FIXME: Unlike the other specs, webpack is including the suffix
|
||||
(resource = resource.replace(/\.(coffee|js)$/, '')) &&
|
||||
RESOURCE_EMBER_GRADEBOOK_SPEC.test(resource) &&
|
||||
!isPartitionMatch(resource, partitions, nodeIndex)
|
||||
)
|
||||
)
|
||||
}
|
||||
} else if (process.env.JSPEC_GROUP === 'jsa') {
|
||||
ignoreResource = (resource, context) => {
|
||||
|
@ -184,6 +220,7 @@ testWebpackConfig.resolve.alias[CONTEXT_EMBER_GRADEBOOK_SPEC] = path.resolve(__d
|
|||
testWebpackConfig.resolve.alias[CONTEXT_COFFEESCRIPT_SPEC] = path.resolve(__dirname, CONTEXT_COFFEESCRIPT_SPEC)
|
||||
testWebpackConfig.resolve.alias[CONTEXT_JSX_SPEC] = path.resolve(__dirname, CONTEXT_JSX_SPEC)
|
||||
testWebpackConfig.resolve.alias['spec/jsx'] = path.resolve(__dirname, 'spec/javascripts/jsx')
|
||||
testWebpackConfig.resolve.extensions.push('.coffee')
|
||||
testWebpackConfig.mode = 'development'
|
||||
testWebpackConfig.module.rules.unshift({
|
||||
test: [
|
||||
|
|
Loading…
Reference in New Issue