forked from moby/moby
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new make target: test-integration-cli-parallel
Usage: $ make test-integration-cli-parallel parallel(1) needs to be installed. Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
- Loading branch information
1 parent
beea4d9
commit 1cd85f5
Showing
8 changed files
with
79 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
bundles | ||
bundles-parallel | ||
.gopath | ||
vendor/pkg | ||
.go-pkg-cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
# ARG1: job number (1..N) | ||
# ARG2: regexp for test case (e.g. TestRunEchoStdout) | ||
set -e | ||
echo "ARGS: $@" | ||
if [ -z $1 ]; then | ||
echo "job number not set" | ||
false | ||
fi | ||
if [ -z $2 ]; then | ||
echo "test regexp not set" | ||
false | ||
fi | ||
set -x | ||
mkdir -p bundles-parallel/$1 | ||
# TODO: dedup binaries | ||
cp -r bundles bundles-parallel/$1 | ||
$(BINDDIR="bundles-parallel/$1/bundles" make --silent echo-docker-run) sh -c "ln -s bundles-parallel/$1/bundles bundles ; KEEPBUNDLE=1 DOCKER_INTEGRATION_TESTS_VERIFIED=1 TESTFLAGS=\"-check.f $2\" hack/make.sh test-integration-cli" | ||
set +x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
TestA | ||
TestB | ||
TestC | ||
TestD | ||
TestE | ||
TestF | ||
TestG | ||
TestH | ||
TestI | ||
TestJ | ||
TestK | ||
TestL | ||
TestM | ||
TestN | ||
TestO | ||
TestP | ||
TestQ | ||
TestR | ||
TestS | ||
TestT | ||
TestU | ||
TestV | ||
TestW | ||
TestX | ||
TestY | ||
TestZ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
### Usage: | ||
### $ sudo apt install parallel | ||
### $ ./contrib/test-integration-cli-parallel.sh | ||
set -e | ||
|
||
: ${NJOBS=$(nproc)} | ||
D=$(pwd)/bundles-parallel | ||
RUNNER=$(pwd)/contrib/.test-integration-cli-parallel | ||
INPUT=$(pwd)/contrib/.test-integration-cli-parallel-commands | ||
PARALLEL=parallel | ||
|
||
echo "Running tests in parallel. see $D for results." | ||
set -x | ||
rm -rf $D/results $D/joblog | ||
mkdir -p $D | ||
$PARALLEL \ | ||
--jobs $NJOBS \ | ||
--results $D/results \ | ||
--joblog $D/joblog \ | ||
--arg-file $INPUT \ | ||
$RUNNER "{#}" "{}" | ||
set +x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1cd85f5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
backup moby#26684 (will be updated soon)
What I did
Introduced
make test-integration-cli-parallel
, which executes multiple integration tests in parallel.Experimental result: 3.8 times faster
on GCE n1-standard-32 (32 vCPUs, 120GB RAM, standard HDD)
DOCKER_INCREMENTAL_BINARY=1 make test-integration-cli
: about 49 minutesDOCKER_INCREMENTAL_BINARY=1 make test-integration-cli-parallel
: about 13 minutesNext steps
The next step is to improve the regexp strings (
TestA
,TestB
, ..,TestZ
) to shorten the makespan (described below).The further next step is to execute the tests in parallel across a Docker Swarm cluster, but I think it can/should be done in an external tool.
Actually I've been already working on such a tool for k8s, and the tool will soon support Docker Swarm as well: https://github.com/osrg/namazu-swarm
Also, the support for "privilged" services would be needed for running integration tests across a Docker Swarm cluster: moby#24862
How I did it
Executes equivalents of the following commands in parallel across multiple
docker-dev
containers, usingparallel(1)
:TESTFLAGS='-check.f TestA' make test-integration-cli
TESTFLAGS='-check.f TestB' make test-integration-cli
TESTFLAGS='-check.f TestZ' make test-integration-cli
As you can see this regexp granularity is not sufficient yet, and we need to improve regexp strings.
I think we can shorten the makespan to less than 5 minutes.
How to verify it
(TODO: rename
bundles-parallel
tobundles/test-integration-cli-parallel
?)Observations from the result:
Even though
Test[FJOQXYZ]
does nothing, they consume a few minutes due to setting up the environment. We really need to remove these regexp strings and deduplicate the setup code.TestB
is long (767 seconds), but the longest test inTestB
(TestBuildAddChangeOwnership
) just takes 34 seconds.Almost all the test cases complete within 30 seconds. A small number of exceptions:
So I think we can shorten the makespan to less than 5 minutes.
Description for the changelog
new make target: test-integration-cli-parallel
A picture of a cute animal (not mandatory but encouraged)**
Signed-off-by: Akihiro Suda suda.akihiro@lab.ntt.co.jp