Commit 34fce6b1 authored by jun's avatar jun

Merge branch 'behatTimeoutMultiplier' into 'master'

Add support for behatTimeoutMultiplier

See merge request integration/nightlyjobs!23
parents 0ef582c3 afafb727
......@@ -138,6 +138,14 @@ class Task {
*/
protected Integer numReruns = 1
/**
* The behat timeout multiplier.
*
* By default behat uses a timeout of 10s. Setting this to any value will get that multiplied
* so 2 means 10 * 2, 3 means 30 and so on. 0 means no multiplier is applied and it's the default.
*/
protected Integer behatTimeoutMultiplier = 0
/**
* The URL of the repository to fetch from.
*
......@@ -213,6 +221,21 @@ class Task {
return numReruns
}
/**
* The timeout multiplier to be applied to behat standard timeout
*
* Can return zero or anything > 1 (1 as multiplier is silly and negatives too).
*/
def getBehatTimeoutMultiplier() {
if (behatTimeoutMultiplier < 0) {
return 0
}
if (behatTimeoutMultiplier == 1) {
return 0
}
return behatTimeoutMultiplier
}
def getPathToRunner(env, steps) {
def runner
if (pathToRunner) {
......
......@@ -116,6 +116,65 @@ class TaskSpec extends Specification {
assert returns == 9
}
def "getBehatTimeoutMultiplier() with no behatTimeoutMultiplier"() {
given:
when:
def task = new Task()
def returns = task.getBehatTimeoutMultiplier()
then:
assert returns == 0
}
def "getBehatTimeoutMultiplier() with correct behatTimeoutMultiplier"() {
given:
def behatTimeoutMultiplier = 3
when:
def task = new Task(behatTimeoutMultiplier : behatTimeoutMultiplier);
def returns = task.getBehatTimeoutMultiplier()
then:
assert returns == 3
}
def "getBehatTimeoutMultiplier() with zero behatTimeoutMultiplier"() {
given:
def behatTimeoutMultiplier = 0
when:
def task = new Task(behatTimeoutMultiplier : behatTimeoutMultiplier);
def returns = task.getBehatTimeoutMultiplier()
then:
assert returns == 0
}
def "getBehatTimeoutMultiplier() with one behatTimeoutMultiplier"() {
given:
def behatTimeoutMultiplier = 1
when:
def task = new Task(behatTimeoutMultiplier : behatTimeoutMultiplier);
def returns = task.getBehatTimeoutMultiplier()
then:
assert returns == 0
}
def "getBehatTimeoutMultiplier() with negative behatTimeoutMultiplier"() {
given:
def behatTimeoutMultiplier = -3
when:
def task = new Task(behatTimeoutMultiplier : behatTimeoutMultiplier);
def returns = task.getBehatTimeoutMultiplier()
then:
assert returns == 0
}
def "getMobileVersion() with no version"() {
given:
def mobileVersion = null
......
......@@ -20,6 +20,7 @@ def call(org.moodle.ci.Task task) {
BEHAT_SUITE = "${task.suite}"
BEHAT_TIMING_FILENAME = "${task.timingFileName}"
BEHAT_NUM_RERUNS = "${task.numReruns}"
BEHAT_INCREASE_TIMEOUT = "${task.behatTimeoutMultiplier}"
}
stages {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment