Run all tests within `libnetwork` namespace with `-p=1`
in a separate `gotestsum` invocation.
Signed-off-by: Roman Volosatovs <roman.volosatovs@docker.com>
| ... | ... |
@@ -199,7 +199,7 @@ pipeline {
|
| 199 | 199 |
} |
| 200 | 200 |
post {
|
| 201 | 201 |
always {
|
| 202 |
- junit testResults: 'bundles/junit-report.xml', allowEmptyResults: true |
|
| 202 |
+ junit testResults: 'bundles/junit-report*.xml', allowEmptyResults: true |
|
| 203 | 203 |
} |
| 204 | 204 |
} |
| 205 | 205 |
} |
| ... | ... |
@@ -238,7 +238,7 @@ pipeline {
|
| 238 | 238 |
sh ''' |
| 239 | 239 |
bundleName=unit |
| 240 | 240 |
echo "Creating ${bundleName}-bundles.tar.gz"
|
| 241 |
- tar -czvf ${bundleName}-bundles.tar.gz bundles/junit-report.xml bundles/go-test-report.json bundles/profile.out
|
|
| 241 |
+ tar -czvf ${bundleName}-bundles.tar.gz bundles/junit-report*.xml bundles/go-test-report*.json bundles/profile*.out
|
|
| 242 | 242 |
''' |
| 243 | 243 |
|
| 244 | 244 |
archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true |
| ... | ... |
@@ -599,7 +599,7 @@ pipeline {
|
| 599 | 599 |
} |
| 600 | 600 |
post {
|
| 601 | 601 |
always {
|
| 602 |
- junit testResults: 'bundles/junit-report.xml', allowEmptyResults: true |
|
| 602 |
+ junit testResults: 'bundles/junit-report*.xml', allowEmptyResults: true |
|
| 603 | 603 |
} |
| 604 | 604 |
} |
| 605 | 605 |
} |
| ... | ... |
@@ -801,7 +801,7 @@ pipeline {
|
| 801 | 801 |
} |
| 802 | 802 |
post {
|
| 803 | 803 |
always {
|
| 804 |
- junit testResults: 'bundles/junit-report.xml', allowEmptyResults: true |
|
| 804 |
+ junit testResults: 'bundles/junit-report*.xml', allowEmptyResults: true |
|
| 805 | 805 |
} |
| 806 | 806 |
} |
| 807 | 807 |
} |
| ... | ... |
@@ -1000,7 +1000,7 @@ pipeline {
|
| 1000 | 1000 |
} |
| 1001 | 1001 |
post {
|
| 1002 | 1002 |
always {
|
| 1003 |
- junit testResults: 'bundles/junit-report.xml', allowEmptyResults: true |
|
| 1003 |
+ junit testResults: 'bundles/junit-report*.xml', allowEmptyResults: true |
|
| 1004 | 1004 |
} |
| 1005 | 1005 |
} |
| 1006 | 1006 |
} |
| ... | ... |
@@ -18,16 +18,35 @@ TESTDIRS="${TESTDIRS:-./...}"
|
| 18 | 18 |
exclude_paths='/vendor/|/integration' |
| 19 | 19 |
pkg_list=$(go list $TESTDIRS | grep -vE "($exclude_paths)") |
| 20 | 20 |
|
| 21 |
-echo "${pkg_list}" | grep --fixed-strings "libnetwork/drivers/bridge" \
|
|
| 21 |
+base_pkg_list=$(echo "${pkg_list}" | grep --fixed-strings -v "/libnetwork" || :)
|
|
| 22 |
+libnetwork_pkg_list=$(echo "${pkg_list}" | grep --fixed-strings "/libnetwork" || :)
|
|
| 23 |
+ |
|
| 24 |
+echo "${libnetwork_pkg_list}" | grep --fixed-strings "libnetwork/drivers/bridge" \
|
|
| 22 | 25 |
&& if ! type docker-proxy; then |
| 23 | 26 |
hack/make.sh binary-proxy install-proxy |
| 24 | 27 |
fi |
| 25 | 28 |
|
| 26 | 29 |
mkdir -p bundles |
| 27 |
-gotestsum --format=standard-quiet --jsonfile=bundles/go-test-report.json --junitfile=bundles/junit-report.xml -- \ |
|
| 28 |
- "${BUILDFLAGS[@]}" \
|
|
| 29 |
- -cover \ |
|
| 30 |
- -coverprofile=bundles/profile.out \ |
|
| 31 |
- -covermode=atomic \ |
|
| 32 |
- ${TESTFLAGS} \
|
|
| 33 |
- ${pkg_list}
|
|
| 30 |
+ |
|
| 31 |
+if [ -n "${base_pkg_list}" ]; then
|
|
| 32 |
+ gotestsum --format=standard-quiet --jsonfile=bundles/go-test-report.json --junitfile=bundles/junit-report.xml -- \ |
|
| 33 |
+ "${BUILDFLAGS[@]}" \
|
|
| 34 |
+ -cover \ |
|
| 35 |
+ -coverprofile=bundles/profile.out \ |
|
| 36 |
+ -covermode=atomic \ |
|
| 37 |
+ ${TESTFLAGS} \
|
|
| 38 |
+ ${base_pkg_list}
|
|
| 39 |
+fi |
|
| 40 |
+if [ -n "${libnetwork_pkg_list}" ]; then
|
|
| 41 |
+ # libnetwork tests invoke iptables, and cannot be run in parallel. Execute |
|
| 42 |
+ # tests within /libnetwork with '-p=1' to run them sequentially. See |
|
| 43 |
+ # https://github.com/moby/moby/issues/42458#issuecomment-873216754 for details. |
|
| 44 |
+ gotestsum --format=standard-quiet --jsonfile=bundles/go-test-report-libnetwork.json --junitfile=bundles/junit-report-libnetwork.xml -- \ |
|
| 45 |
+ "${BUILDFLAGS[@]}" \
|
|
| 46 |
+ -cover \ |
|
| 47 |
+ -coverprofile=bundles/profile-libnetwork.out \ |
|
| 48 |
+ -covermode=atomic \ |
|
| 49 |
+ -p=1 \ |
|
| 50 |
+ ${TESTFLAGS} \
|
|
| 51 |
+ ${libnetwork_pkg_list}
|
|
| 52 |
+fi |