Add --parallel flag to helm test (#4144)

* Refactor test run to separate method

This will allow us to parallelise it more easily

Signed-off-by: Frank Hamand <frankhamand@gmail.com>

* Add --parallel flag to helm test

(No functionality in this commit)

Signed-off-by: Frank Hamand <frankhamand@gmail.com>

* Run helm tests in parallel with --parallel flag

Signed-off-by: Frank Hamand <frankhamand@gmail.com>

* Add a mutex to helm test message streams

This is to protect against data races when running tests in parallel.

Signed-off-by: Frank Hamand <frankhamand@gmail.com>

* Add tests for --parallel flag

Signed-off-by: Frank Hamand <frankhamand@gmail.com>

* Add concurrency limit for parallel helm tests

Signed-off-by: Frank Hamand <frankhamand@gmail.com>

* Add test for concurrency limit

Signed-off-by: Frank Hamand <frankhamand@gmail.com>

* Fix rebase introduced errors

Signed-off-by: Frank Hamand <frankhamand@gmail.com>
pull/5022/head
Frank Hamand 6 years ago committed by Matthew Fisher
parent 15703cb199
commit 158d6dbb74

@ -339,6 +339,8 @@ message TestReleaseRequest {
int64 timeout = 2;
// cleanup specifies whether or not to attempt pod deletion after test completes
bool cleanup = 3;
// parallel specifies whether or not to run test pods in parallel
bool parallel = 4;
}
// TestReleaseResponse represents a message from executing a test

@ -34,11 +34,12 @@ 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
name string
out io.Writer
client helm.Interface
timeout int64
cleanup bool
parallel bool
}
func newReleaseTestCmd(c helm.Interface, out io.Writer) *cobra.Command {
@ -67,6 +68,7 @@ func newReleaseTestCmd(c helm.Interface, out io.Writer) *cobra.Command {
settings.AddFlagsTLS(f)
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")
// set defaults from environment
settings.InitTLS(f)
@ -79,6 +81,7 @@ func (t *releaseTestCmd) run() (err error) {
t.name,
helm.ReleaseTestTimeout(t.timeout),
helm.ReleaseTestCleanup(t.cleanup),
helm.ReleaseTestParallel(t.parallel),
)
testErr := &testErr{}

@ -20,6 +20,7 @@ helm test [RELEASE] [flags]
```
--cleanup delete test pods upon completion
-h, --help help for test
--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
--tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem")
@ -45,4 +46,4 @@ helm test [RELEASE] [flags]
* [helm](helm.md) - The Helm package manager for Kubernetes.
###### Auto generated by spf13/cobra on 10-Aug-2018
###### Auto generated by spf13/cobra on 9-Nov-2018

8
glide.lock generated

@ -1,5 +1,5 @@
hash: fcbba2207c6511df365dfe355dfe601a862d340bbf15db47938a404fd0ec58d0
updated: 2018-11-11T19:26:29.631232-05:00
hash: 813d803db5fc2cb46f8050190d2a307f247da5b7b3a4b00eb4d3e766882ad4f9
updated: 2018-11-30T10:55:17.417707Z
imports:
- name: cloud.google.com/go
version: 3b1ae45394a234c385be014e9a488f2bb6eef821
@ -290,6 +290,10 @@ imports:
- internal
- jws
- jwt
- name: golang.org/x/sync
version: 1d60e4601c6fd243af51cc01ddf169918a5407ca
subpackages:
- semaphore
- name: golang.org/x/sys
version: 95c6576299259db960f6c5b9b69ea52422860fce
subpackages:

@ -3,6 +3,9 @@ import:
- package: golang.org/x/net
subpackages:
- context
- package: golang.org/x/sync
subpackages:
- semaphore
- package: github.com/spf13/cobra
version: fe5e611709b0c57fa4a89136deaa8e1d4004d053
- package: github.com/spf13/pflag
@ -41,7 +44,6 @@ import:
- package: github.com/prometheus/client_golang
version: 0.8.0
- package: github.com/grpc-ecosystem/go-grpc-prometheus
- package: k8s.io/kubernetes
version: release-1.12
- package: k8s.io/client-go

@ -227,6 +227,13 @@ func ReleaseTestCleanup(cleanup bool) ReleaseTestOption {
}
}
// ReleaseTestParallel is a boolean value representing whether to run test pods in parallel
func ReleaseTestParallel(parallel bool) ReleaseTestOption {
return func(opts *options) {
opts.testReq.Parallel = parallel
}
}
// RollbackTimeout specifies the number of seconds before kubernetes calls timeout
func RollbackTimeout(timeout int64) RollbackOption {
return func(opts *options) {

@ -883,6 +883,8 @@ type TestReleaseRequest struct {
Timeout int64 `protobuf:"varint,2,opt,name=timeout" json:"timeout,omitempty"`
// cleanup specifies whether or not to attempt pod deletion after test completes
Cleanup bool `protobuf:"varint,3,opt,name=cleanup" json:"cleanup,omitempty"`
// parallel specifies whether or not to run test pods in parallel
Parallel bool `protobuf:"varint,4,opt,name=parallel" json:"parallel,omitempty"`
}
func (m *TestReleaseRequest) Reset() { *m = TestReleaseRequest{} }
@ -911,6 +913,13 @@ func (m *TestReleaseRequest) GetCleanup() bool {
return false
}
func (m *TestReleaseRequest) GetParallel() bool {
if m != nil {
return m.Parallel
}
return false
}
// TestReleaseResponse represents a message from executing a test
type TestReleaseResponse struct {
Msg string `protobuf:"bytes,1,opt,name=msg" json:"msg,omitempty"`
@ -1415,85 +1424,86 @@ var _ReleaseService_serviceDesc = grpc.ServiceDesc{
func init() { proto.RegisterFile("hapi/services/tiller.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
// 1276 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0xdd, 0x6e, 0xe3, 0x44,
0x14, 0x6e, 0xe2, 0xfc, 0x9e, 0x74, 0x43, 0x76, 0x36, 0xdb, 0x7a, 0xcd, 0x82, 0x82, 0x11, 0x6c,
0x76, 0x61, 0x53, 0x08, 0xdc, 0x20, 0x21, 0xa4, 0x6e, 0x36, 0x6a, 0x0b, 0xa5, 0x2b, 0x39, 0xed,
0x22, 0x21, 0x50, 0xe4, 0x26, 0x93, 0xd6, 0xac, 0x63, 0x07, 0xcf, 0xb8, 0x6c, 0x1f, 0x00, 0x24,
0xde, 0x83, 0x07, 0xe1, 0x3d, 0x78, 0x0e, 0xee, 0x91, 0xe7, 0x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0b, 0xd9, 0x00,
0x37, 0x2d, 0x04, 0x3d, 0xc9, 0x25, 0x44, 0xed, 0x3c, 0x46, 0xff, 0x76, 0xc5, 0xd8, 0xc5, 0x0a,
0xde, 0x49, 0xbd, 0xe8, 0x28, 0x07, 0x9a, 0xec, 0x01, 0xc8, 0x78, 0x5e, 0x50, 0x3b, 0x95, 0x94,
0xe8, 0x4a, 0x1b, 0x92, 0x52, 0x5b, 0xde, 0x86, 0xa4, 0x52, 0x0d, 0xce, 0xdc, 0x42, 0x0e, 0xb4,
0xad, 0xd0, 0x13, 0xae, 0xa3, 0xb6, 0x80, 0x72, 0x4e, 0xaf, 0x77, 0x35, 0xe3, 0x69, 0x01, 0xcd,
0x9b, 0xfa, 0x7e, 0x01, 0x3f, 0x36, 0xa4, 0xea, 0x79, 0x8d, 0xfd, 0x57, 0xfe, 0xc5, 0x7f, 0x01,
0x00, 0x00, 0xff, 0xff, 0x38, 0x07, 0x4c, 0x12, 0x83, 0x10, 0x00, 0x00,
// 1289 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0xed, 0x72, 0xdb, 0x44,
0x17, 0x8e, 0x2d, 0x7f, 0x1e, 0xa7, 0x7e, 0xdd, 0x6d, 0x9a, 0xa8, 0x7a, 0x0b, 0x63, 0xc4, 0x40,
0xdd, 0x42, 0x1d, 0x30, 0xfc, 0x61, 0x86, 0x61, 0x26, 0x75, 0x3d, 0x49, 0x21, 0xa4, 0x33, 0x72,
0x5b, 0x66, 0x98, 0x61, 0x3c, 0x8a, 0xbd, 0x6e, 0x45, 0x65, 0xc9, 0x68, 0x57, 0xa1, 0xb9, 0x00,
0x98, 0xe1, 0x3e, 0xb8, 0x10, 0xee, 0x83, 0xeb, 0xe0, 0x3f, 0xb3, 0x5f, 0x8a, 0x56, 0x96, 0x1c,
0x91, 0x3f, 0xb1, 0x76, 0xcf, 0xd9, 0xf3, 0xf1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 0x20, 0x17, 0xe0, 0xaa, 0xbd,
0xa0, 0x07, 0x85, 0x84, 0xe8, 0x5d, 0xc9, 0x1a, 0x5c, 0xaf, 0x98, 0xb8, 0x58, 0xc3, 0xff, 0x32,
0xaf, 0x3d, 0x2a, 0x80, 0x26, 0x7f, 0x38, 0xb2, 0x1e, 0x97, 0xd4, 0xce, 0x24, 0x25, 0x3b, 0xd6,
0x96, 0xa4, 0xf4, 0x76, 0xb8, 0x25, 0xa9, 0x4c, 0xf3, 0xb3, 0x77, 0x90, 0x07, 0x5d, 0x27, 0x0e,
0xa4, 0x6b, 0xd6, 0x16, 0x50, 0xc1, 0xe9, 0xcd, 0x8e, 0x67, 0x3d, 0x2c, 0xa1, 0x79, 0x55, 0xdf,
0x4f, 0xe0, 0xc7, 0x96, 0x52, 0x3d, 0x6f, 0xf0, 0xff, 0xd8, 0xbf, 0xf8, 0x37, 0x00, 0x00, 0xff,
0xff, 0xb6, 0x48, 0x98, 0x76, 0x9f, 0x10, 0x00, 0x00,
}

@ -20,6 +20,7 @@ import (
"bytes"
"fmt"
"log"
"sync"
"time"
"k8s.io/api/core/v1"
@ -31,10 +32,13 @@ import (
// Environment encapsulates information about where test suite executes and returns results
type Environment struct {
Namespace string
KubeClient environment.KubeClient
Stream services.ReleaseService_RunReleaseTestServer
Timeout int64
Namespace string
KubeClient environment.KubeClient
Stream services.ReleaseService_RunReleaseTestServer
Timeout int64
Parallel bool
Parallelism uint32
streamLock sync.Mutex
}
func (env *Environment) createTestPod(test *test) error {
@ -108,6 +112,8 @@ func (env *Environment) streamUnknown(name, info string) error {
func (env *Environment) streamMessage(msg string, status release.TestRun_Status) error {
resp := &services.TestReleaseResponse{Msg: msg, Status: status}
env.streamLock.Lock()
defer env.streamLock.Unlock()
return env.Stream.Send(resp)
}

@ -121,10 +121,11 @@ func newMockTestingEnvironment() *MockTestingEnvironment {
return &MockTestingEnvironment{
Environment: &Environment{
Namespace: "default",
KubeClient: tEnv.KubeClient,
Timeout: 5,
Stream: &mockStream{},
Namespace: "default",
KubeClient: tEnv.KubeClient,
Timeout: 5,
Stream: &mockStream{},
Parallelism: 20,
},
}
}

@ -17,7 +17,9 @@ limitations under the License.
package releasetesting
import (
"context"
"fmt"
"golang.org/x/sync/semaphore"
"strings"
"github.com/ghodss/yaml"
@ -69,53 +71,91 @@ func (ts *TestSuite) Run(env *Environment) error {
env.streamMessage("No Tests Found", release.TestRun_UNKNOWN)
}
var tests []*test
for _, testManifest := range ts.TestManifests {
test, err := newTest(testManifest)
if err != nil {
return err
}
test.result.StartedAt = timeconv.Now()
if err := env.streamRunning(test.result.Name); err != nil {
return err
tests = append(tests, test)
}
if env.Parallel {
c := make(chan error, len(tests))
// Use a semaphore to restrict the number of tests running in parallel.
sem := semaphore.NewWeighted(int64(env.Parallelism))
ctx := context.Background()
for _, t := range tests {
sem.Acquire(ctx, 1)
go func(t *test, sem *semaphore.Weighted) {
defer sem.Release(1)
c <- t.run(env)
}(t, sem)
}
test.result.Status = release.TestRun_RUNNING
resourceCreated := true
if err := env.createTestPod(test); err != nil {
resourceCreated = false
if streamErr := env.streamError(test.result.Info); streamErr != nil {
for range tests {
if err := <-c; err != nil {
return err
}
}
resourceCleanExit := true
status := v1.PodUnknown
if resourceCreated {
status, err = env.getTestPodStatus(test)
if err != nil {
resourceCleanExit = false
if streamErr := env.streamError(test.result.Info); streamErr != nil {
return streamErr
}
} else {
for _, t := range tests {
if err := t.run(env); err != nil {
return err
}
}
}
if resourceCreated && resourceCleanExit {
if err := test.assignTestResult(status); err != nil {
return err
}
for _, t := range tests {
ts.Results = append(ts.Results, t.result)
}
if err := env.streamResult(test.result); err != nil {
return err
ts.CompletedAt = timeconv.Now()
return nil
}
func (t *test) run(env *Environment) error {
t.result.StartedAt = timeconv.Now()
if err := env.streamRunning(t.result.Name); err != nil {
return err
}
t.result.Status = release.TestRun_RUNNING
resourceCreated := true
if err := env.createTestPod(t); err != nil {
resourceCreated = false
if streamErr := env.streamError(t.result.Info); streamErr != nil {
return err
}
}
resourceCleanExit := true
status := v1.PodUnknown
if resourceCreated {
var err error
status, err = env.getTestPodStatus(t)
if err != nil {
resourceCleanExit = false
if streamErr := env.streamError(t.result.Info); streamErr != nil {
return streamErr
}
}
}
if resourceCreated && resourceCleanExit {
if err := t.assignTestResult(status); err != nil {
return err
}
test.result.CompletedAt = timeconv.Now()
ts.Results = append(ts.Results, test.result)
if err := env.streamResult(t.result); err != nil {
return err
}
}
ts.CompletedAt = timeconv.Now()
t.result.CompletedAt = timeconv.Now()
return nil
}

@ -220,6 +220,107 @@ func TestExtractTestManifestsFromHooks(t *testing.T) {
}
}
func TestParallelTestRun(t *testing.T) {
ts := testSuiteFixture([]string{manifestWithTestSuccessHook, manifestWithTestSuccessHook})
env := testEnvFixture()
env.Parallel = true
env.KubeClient = newSleepOnWaitKubeClient()
if err := ts.Run(env); err != nil {
t.Errorf("%s", err)
}
if len(ts.Results) != 2 {
t.Errorf("Expected 2 test result. Got %v", len(ts.Results))
}
stream := env.Stream.(*mockStream)
if len(stream.messages) != 4 {
t.Errorf("Expected four messages, Got: %v", len(stream.messages))
}
if stream.messages[0].Status != release.TestRun_RUNNING {
t.Errorf("Expected first message status to be RUNNING, Got: %v", stream.messages[0].Status)
}
if stream.messages[1].Status != release.TestRun_RUNNING {
t.Errorf("Expected second message status to be RUNNING, Got: %v", stream.messages[1].Status)
}
if stream.messages[2].Status != release.TestRun_SUCCESS {
t.Errorf("Expected third message status to be SUCCESS, Got: %v", stream.messages[2].Status)
}
if stream.messages[3].Status != release.TestRun_SUCCESS {
t.Errorf("Expected fourth message status to be SUCCESS, Got: %v", stream.messages[3].Status)
}
}
func TestParallelTestRunFailure(t *testing.T) {
ts := testSuiteFixture([]string{manifestWithTestSuccessHook, manifestWithTestFailureHook})
env := testEnvFixture()
env.Parallel = true
env.KubeClient = newSleepOnWaitKubeClient()
if err := ts.Run(env); err != nil {
t.Errorf("%s", err)
}
if len(ts.Results) != 2 {
t.Errorf("Expected 2 test result. Got %v", len(ts.Results))
}
stream := env.Stream.(*mockStream)
if len(stream.messages) != 4 {
t.Errorf("Expected four messages, Got: %v", len(stream.messages))
}
if stream.messages[0].Status != release.TestRun_RUNNING {
t.Errorf("Expected first message status to be RUNNING, Got: %v", stream.messages[0].Status)
}
if stream.messages[1].Status != release.TestRun_RUNNING {
t.Errorf("Expected second message status to be RUNNING, Got: %v", stream.messages[1].Status)
}
if ts.Results[0].Status != release.TestRun_SUCCESS {
t.Errorf("Expected first test result to be successful, got: %v", ts.Results[0].Status)
}
if ts.Results[1].Status != release.TestRun_FAILURE {
t.Errorf("Expected second test result to be failure, got: %v", ts.Results[1].Status)
}
}
func TestParallelism(t *testing.T) {
ts := testSuiteFixture([]string{manifestWithTestSuccessHook, manifestWithTestSuccessHook, manifestWithTestFailureHook})
env := testEnvFixture()
env.Parallel = true
env.Parallelism = 2
env.KubeClient = newSleepOnWaitKubeClient()
if err := ts.Run(env); err != nil {
t.Errorf("%s", err)
}
stream := env.Stream.(*mockStream)
if stream.messages[0].Status != release.TestRun_RUNNING {
t.Errorf("Expected first message status to be RUNNING, Got: %v", stream.messages[0].Status)
}
if stream.messages[1].Status != release.TestRun_RUNNING {
t.Errorf("Expected second message status to be RUNNING, Got: %v", stream.messages[1].Status)
}
if stream.messages[2].Status == release.TestRun_RUNNING {
t.Errorf("Expected third message status to be not be RUNNING")
}
if ts.Results[0].Status != release.TestRun_SUCCESS {
t.Errorf("Expected first test result to be successful, got: %v", ts.Results[0].Status)
}
if ts.Results[1].Status != release.TestRun_SUCCESS {
t.Errorf("Expected second test result to be successful, got: %v", ts.Results[1].Status)
}
if ts.Results[2].Status != release.TestRun_FAILURE {
t.Errorf("Expected third test result to be failure, got: %v", ts.Results[2].Status)
}
}
func chartStub() *chart.Chart {
return &chart.Chart{
Metadata: &chart.Metadata{
@ -328,6 +429,26 @@ func (p *podSucceededKubeClient) WaitAndGetCompletedPodPhase(ns string, r io.Rea
return v1.PodSucceeded, nil
}
// For testing parallelism, this kube client
// will sleep for 1ms before returning completed pod
// phase.
type sleepOnWaitKubeClient struct {
tillerEnv.PrintingKubeClient
firstWait bool
}
func newSleepOnWaitKubeClient() *sleepOnWaitKubeClient {
return &sleepOnWaitKubeClient{
PrintingKubeClient: tillerEnv.PrintingKubeClient{Out: ioutil.Discard},
}
}
func (p *sleepOnWaitKubeClient) WaitAndGetCompletedPodPhase(ns string, r io.Reader, timeout time.Duration) (v1.PodPhase, error) {
time.Sleep(1 * time.Millisecond)
return v1.PodSucceeded, nil
}
type podFailedKubeClient struct {
tillerEnv.PrintingKubeClient
}

@ -22,6 +22,8 @@ import (
reltesting "k8s.io/helm/pkg/releasetesting"
)
const maxParallelism = 20
// RunReleaseTest runs pre-defined tests stored as hooks on a given release
func (s *ReleaseServer) RunReleaseTest(req *services.TestReleaseRequest, stream services.ReleaseService_RunReleaseTestServer) error {
@ -37,10 +39,12 @@ func (s *ReleaseServer) RunReleaseTest(req *services.TestReleaseRequest, stream
}
testEnv := &reltesting.Environment{
Namespace: rel.Namespace,
KubeClient: s.env.KubeClient,
Timeout: req.Timeout,
Stream: stream,
Namespace: rel.Namespace,
KubeClient: s.env.KubeClient,
Timeout: req.Timeout,
Stream: stream,
Parallel: req.Parallel,
Parallelism: maxParallelism,
}
s.Log("running tests for release %s", rel.Name)
tSuite, err := reltesting.NewTestSuite(rel)

Loading…
Cancel
Save