Commit ed8f17a8 authored by Ting-Wai's avatar Ting-Wai Committed by Martin Hickey

Parameterize maximum number of tests pods to run in parallel (#6078)

Signed-off-by: 's avatarTing-Wai To <tingwai@bitgo.com>
parent eaeb0346
......@@ -350,6 +350,8 @@ message TestReleaseRequest {
bool cleanup = 3;
// parallel specifies whether or not to run test pods in parallel
bool parallel = 4;
// maximum number of test pods to run in parallel
uint32 max_parallel = 5;
}
// TestReleaseResponse represents a message from executing a test
......
......@@ -34,12 +34,13 @@ The tests to be run are defined in the chart that was installed.
`
type releaseTestCmd struct {
name string
out io.Writer
client helm.Interface
timeout int64
cleanup bool
parallel bool
name string
out io.Writer
client helm.Interface
timeout int64
cleanup bool
parallel bool
maxParallel uint32
}
func newReleaseTestCmd(c helm.Interface, out io.Writer) *cobra.Command {
......@@ -69,6 +70,7 @@ func newReleaseTestCmd(c helm.Interface, out io.Writer) *cobra.Command {
f.Int64Var(&rlsTest.timeout, "timeout", 300, "Time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks)")
f.BoolVar(&rlsTest.cleanup, "cleanup", false, "Delete test pods upon completion")
f.BoolVar(&rlsTest.parallel, "parallel", false, "Run test pods in parallel")
f.Uint32Var(&rlsTest.maxParallel, "max", 20, "Maximum number of test pods to run in parallel")
// set defaults from environment
settings.InitTLS(f)
......@@ -82,6 +84,7 @@ func (t *releaseTestCmd) run() (err error) {
helm.ReleaseTestTimeout(t.timeout),
helm.ReleaseTestCleanup(t.cleanup),
helm.ReleaseTestParallel(t.parallel),
helm.ReleaseTestMaxParallel(t.maxParallel),
)
testErr := &testErr{}
......
......@@ -20,6 +20,7 @@ helm test [RELEASE] [flags]
```
--cleanup Delete test pods upon completion
-h, --help help for test
--max uint32 Maximum number of test pods to run in parallel (default 20)
--parallel Run test pods in parallel
--timeout int Time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks) (default 300)
--tls Enable TLS for request
......@@ -46,4 +47,4 @@ helm test [RELEASE] [flags]
* [helm](helm.md) - The Helm package manager for Kubernetes.
###### Auto generated by spf13/cobra on 16-May-2019
###### Auto generated by spf13/cobra on 25-Jul-2019
......@@ -234,6 +234,13 @@ func ReleaseTestParallel(parallel bool) ReleaseTestOption {
}
}
// ReleaseTestMaxParallel specifies the maximum number of test pods to run in parallel
func ReleaseTestMaxParallel(max uint32) ReleaseTestOption {
return func(opts *options) {
opts.testReq.MaxParallel = max
}
}
// RollbackTimeout specifies the number of seconds before kubernetes calls timeout
func RollbackTimeout(timeout int64) RollbackOption {
return func(opts *options) {
......
This diff is collapsed.
......@@ -38,13 +38,18 @@ func (s *ReleaseServer) RunReleaseTest(req *services.TestReleaseRequest, stream
return err
}
parallelism := uint32(maxParallelism)
if req.MaxParallel != 0 {
parallelism = req.MaxParallel
}
testEnv := &reltesting.Environment{
Namespace: rel.Namespace,
KubeClient: s.env.KubeClient,
Timeout: req.Timeout,
Stream: stream,
Parallel: req.Parallel,
Parallelism: maxParallelism,
Parallelism: parallelism,
}
s.Log("running tests for release %s", rel.Name)
tSuite, err := reltesting.NewTestSuite(rel)
......
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