Commit 54ee8e8c authored by Steve Azzopardi's avatar Steve Azzopardi

Merge branch 'use-parallel-for-tests-parallelization' into 'master'

Change parallel tests configuration ENV names

See merge request gitlab-org/gitlab-runner!1095
parents 2aeea0e6 1edf5f98
......@@ -195,13 +195,11 @@ code_quality:
paths: [gl-code-quality-report.json]
expire_in: 7d
.unit_tests: &unit_tests
unit test: &unit_tests
<<: *docker
stage: test
parallel: 5
script:
- JOB_NAME=( $CI_JOB_NAME )
- export SUITE_INDEX=${JOB_NAME[-2]}
- export SUITE_TOTAL=${JOB_NAME[-1]}
- source ci/touch_make_dependencies
- make parallel_test_execute
artifacts:
......@@ -211,7 +209,7 @@ code_quality:
when: always
expire_in: 7d
.unit_tests_with_race: &unit_tests_with_race
unit test with race:
<<: *unit_tests
allow_failure: true
variables:
......@@ -219,18 +217,6 @@ code_quality:
CGO_ENABLED: "1"
TESTFLAGS: "-cover -race"
unit tests 0 5: *unit_tests
unit tests 1 5: *unit_tests
unit tests 2 5: *unit_tests
unit tests 3 5: *unit_tests
unit tests 4 5: *unit_tests
unit tests with race 0 5: *unit_tests_with_race
unit tests with race 1 5: *unit_tests_with_race
unit tests with race 2 5: *unit_tests_with_race
unit tests with race 3 5: *unit_tests_with_race
unit tests with race 4 5: *unit_tests_with_race
docs check links:
image: "registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-docs-lint"
stage: test
......@@ -297,7 +283,7 @@ git 1.7.1:
image: golang:1.10
when: always
test coverage report: &test_coverage_report
test coverage report:
<<: *coverage_job
coverage: /regular total:\s+\(statements\)\s+\d+.\d+\%/
script:
......@@ -310,7 +296,7 @@ test coverage report: &test_coverage_report
expire_in: 7d
race conditions detector:
<<: *test_coverage_report
<<: *coverage_job
script:
- source ci/touch_make_dependencies
- make check_race_conditions
......
......@@ -7,8 +7,8 @@ testsDefinitions="testsdefinitions.txt"
TESTFLAGS=${TESTFLAGS:-"-cover"}
PARALLEL_TESTS_LIMIT=${PARALLEL_TESTS_LIMIT:-10}
SUITE_TOTAL=${SUITE_TOTAL:-1}
SUITE_INDEX=${SUITE_INDEX:-0}
CI_NODE_TOTAL=${CI_NODE_TOTAL:-1}
CI_NODE_INDEX=${CI_NODE_INDEX:-0}
output="regular"
coverMode="count"
......@@ -121,13 +121,14 @@ executeTestPart() {
local numberOfDefinitions
numberOfDefinitions=$(< "${testsDefinitions}" wc -l)
local executionSize
executionSize=$((numberOfDefinitions/SUITE_TOTAL+1))
executionSize=$((numberOfDefinitions/CI_NODE_TOTAL+1))
local nodeIndex=$((CI_NODE_INDEX-1))
local executionOffset
executionOffset=$((SUITE_INDEX*executionSize+1))
executionOffset=$((nodeIndex*executionSize+1))
printMessage "Number of definitions: ${numberOfDefinitions}"
printMessage "Suite size: ${SUITE_TOTAL}"
printMessage "Suite index: ${SUITE_INDEX}"
printMessage "Suite size: ${CI_NODE_TOTAL}"
printMessage "Suite index: ${CI_NODE_INDEX}"
printMessage "Execution size: ${executionSize}"
printMessage "Execution offset: ${executionOffset}"
......
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