Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
0f4f6cce
Commit
0f4f6cce
authored
Apr 09, 2015
by
Victor Marmol
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6655 from yujuhong/parallel_tests
Limit the number of concurrent tests in integration.go
parents
9bf39481
faf47b6f
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
7 deletions
+22
-7
.travis.yml
.travis.yml
+1
-1
integration.go
cmd/integration/integration.go
+17
-3
test-integration.sh
hack/test-integration.sh
+3
-2
shippable.yml
shippable.yml
+1
-1
No files found.
.travis.yml
View file @
0f4f6cce
...
@@ -24,7 +24,7 @@ install:
...
@@ -24,7 +24,7 @@ install:
script
:
script
:
-
KUBE_RACE="-race" KUBE_COVER="y" KUBE_GOVERALLS_BIN="$HOME/gopath/bin/goveralls" KUBE_TIMEOUT='-timeout 300s' KUBE_COVERPROCS=8 KUBE_TEST_API_VERSIONS=$KUBE_TEST_API_VERSIONS ./hack/test-go.sh -- -p=2
-
KUBE_RACE="-race" KUBE_COVER="y" KUBE_GOVERALLS_BIN="$HOME/gopath/bin/goveralls" KUBE_TIMEOUT='-timeout 300s' KUBE_COVERPROCS=8 KUBE_TEST_API_VERSIONS=$KUBE_TEST_API_VERSIONS ./hack/test-go.sh -- -p=2
-
PATH=$HOME/gopath/bin:./third_party/etcd:$PATH ./hack/test-cmd.sh
-
PATH=$HOME/gopath/bin:./third_party/etcd:$PATH ./hack/test-cmd.sh
-
PATH=$HOME/gopath/bin:./third_party/etcd:$PATH KUBE_TEST_API_VERSIONS=$KUBE_TEST_API_VERSIONS ./hack/test-integration.sh
-
PATH=$HOME/gopath/bin:./third_party/etcd:$PATH KUBE_TEST_API_VERSIONS=$KUBE_TEST_API_VERSIONS
KUBE_INTEGRATION_TEST_MAX_CONCURRENCY=4
./hack/test-integration.sh
notifications
:
notifications
:
irc
:
"
chat.freenode.net#google-containers"
irc
:
"
chat.freenode.net#google-containers"
cmd/integration/integration.go
View file @
0f4f6cce
...
@@ -67,6 +67,8 @@ var (
...
@@ -67,6 +67,8 @@ var (
fakeDocker1
,
fakeDocker2
dockertools
.
FakeDockerClient
fakeDocker1
,
fakeDocker2
dockertools
.
FakeDockerClient
// API version that should be used by the client to talk to the server.
// API version that should be used by the client to talk to the server.
apiVersion
string
apiVersion
string
// Limit the number of concurrent tests.
maxConcurrency
int
)
)
type
fakeKubeletClient
struct
{}
type
fakeKubeletClient
struct
{}
...
@@ -947,6 +949,8 @@ type testFunc func(*client.Client)
...
@@ -947,6 +949,8 @@ type testFunc func(*client.Client)
func
addFlags
(
fs
*
pflag
.
FlagSet
)
{
func
addFlags
(
fs
*
pflag
.
FlagSet
)
{
fs
.
StringVar
(
&
apiVersion
,
"apiVersion"
,
latest
.
Version
,
"API version that should be used by the client for communicating with the server"
)
fs
.
StringVar
(
&
apiVersion
,
"apiVersion"
,
latest
.
Version
,
"API version that should be used by the client for communicating with the server"
)
fs
.
IntVar
(
&
maxConcurrency
,
"maxConcurrency"
,
-
1
,
"Maximum number of tests to be run simultaneously. Unlimited if set to negative."
)
}
}
func
main
()
{
func
main
()
{
...
@@ -994,16 +998,26 @@ func main() {
...
@@ -994,16 +998,26 @@ func main() {
},
},
}
}
// Only run at most maxConcurrency tests in parallel.
numFinishedTests
:=
0
for
numFinishedTests
<
len
(
testFuncs
)
{
numTestsToRun
:=
len
(
testFuncs
)
-
numFinishedTests
if
maxConcurrency
>
0
&&
numTestsToRun
>
maxConcurrency
{
numTestsToRun
=
maxConcurrency
}
glog
.
Infof
(
"Running %d tests in parallel."
,
numTestsToRun
)
var
wg
sync
.
WaitGroup
var
wg
sync
.
WaitGroup
wg
.
Add
(
len
(
testFuncs
)
)
wg
.
Add
(
numTestsToRun
)
for
i
:=
range
testFuncs
{
for
i
:=
0
;
i
<
numTestsToRun
;
i
++
{
f
:=
testFuncs
[
i
]
f
:=
testFuncs
[
i
+
numFinishedTests
]
go
func
()
{
go
func
()
{
f
(
kubeClient
)
f
(
kubeClient
)
wg
.
Done
()
wg
.
Done
()
}()
}()
}
}
wg
.
Wait
()
wg
.
Wait
()
numFinishedTests
+=
numTestsToRun
}
// Check that kubelet tried to make the containers.
// Check that kubelet tried to make the containers.
// Using a set to list unique creation attempts. Our fake is
// Using a set to list unique creation attempts. Our fake is
...
...
hack/test-integration.sh
View file @
0f4f6cce
...
@@ -26,7 +26,7 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
...
@@ -26,7 +26,7 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
source
"
${
KUBE_ROOT
}
/hack/lib/init.sh"
source
"
${
KUBE_ROOT
}
/hack/lib/init.sh"
# Comma separated list of API Versions that should be tested.
# Comma separated list of API Versions that should be tested.
KUBE_TEST_API_VERSIONS
=
${
KUBE_TEST_API_VERSIONS
:-
"v1beta1,v1beta3"
}
KUBE_TEST_API_VERSIONS
=
${
KUBE_TEST_API_VERSIONS
:-
"v1beta1,v1beta3"
}
KUBE_INTEGRATION_TEST_MAX_CONCURRENCY
=
${
KUBE_INTEGRATION_TEST_MAX_CONCURRENCY
:-
"-1"
}
cleanup
()
{
cleanup
()
{
kube::etcd::cleanup
kube::etcd::cleanup
...
@@ -44,7 +44,8 @@ runTests() {
...
@@ -44,7 +44,8 @@ runTests() {
kube::log::status
"Running integration test scenario"
kube::log::status
"Running integration test scenario"
"
${
KUBE_OUTPUT_HOSTBIN
}
/integration"
--v
=
2
--apiVersion
=
"
$1
"
"
${
KUBE_OUTPUT_HOSTBIN
}
/integration"
--v
=
2
--apiVersion
=
"
$1
"
\
--maxConcurrency
=
"
${
KUBE_INTEGRATION_TEST_MAX_CONCURRENCY
}
"
cleanup
cleanup
}
}
...
...
shippable.yml
View file @
0f4f6cce
...
@@ -33,7 +33,7 @@ install:
...
@@ -33,7 +33,7 @@ install:
script
:
script
:
-
KUBE_RACE="-race" KUBE_COVER="y" KUBE_GOVERALLS_BIN="$HOME/gopath/bin/goveralls" KUBE_TIMEOUT='-timeout 300s' KUBE_COVERPROCS=8 KUBE_TEST_API_VERSIONS=$KUBE_TEST_API_VERSIONS ./hack/test-go.sh -- -p=2
-
KUBE_RACE="-race" KUBE_COVER="y" KUBE_GOVERALLS_BIN="$HOME/gopath/bin/goveralls" KUBE_TIMEOUT='-timeout 300s' KUBE_COVERPROCS=8 KUBE_TEST_API_VERSIONS=$KUBE_TEST_API_VERSIONS ./hack/test-go.sh -- -p=2
-
PATH=$HOME/gopath/bin:./third_party/etcd:$PATH ./hack/test-cmd.sh
-
PATH=$HOME/gopath/bin:./third_party/etcd:$PATH ./hack/test-cmd.sh
-
PATH=$HOME/gopath/bin:./third_party/etcd:$PATH KUBE_TEST_API_VERSIONS=$KUBE_TEST_API_VERSIONS ./hack/test-integration.sh
-
PATH=$HOME/gopath/bin:./third_party/etcd:$PATH KUBE_TEST_API_VERSIONS=$KUBE_TEST_API_VERSIONS
KUBE_INTEGRATION_TEST_MAX_CONCURRENCY=4
./hack/test-integration.sh
notifications
:
notifications
:
irc
:
"
chat.freenode.net#google-containers"
irc
:
"
chat.freenode.net#google-containers"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment