mirror of
https://github.com/helm/helm.git
synced 2026-04-23 07:07:30 -04:00
Fix race condition in TestInstallRelease_Wait_Interrupted test
Signed-off-by: Alex Johnson <hello@alex-johnson.net>
This commit is contained in:
parent
a2a324e511
commit
f69a2dd03e
1 changed files with 4 additions and 7 deletions
|
|
@ -429,16 +429,14 @@ func TestInstallRelease_Wait_Interrupted(t *testing.T) {
|
|||
instAction.Wait = true
|
||||
vals := map[string]interface{}{}
|
||||
|
||||
ctx := context.Background()
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
time.AfterFunc(time.Second, cancel)
|
||||
|
||||
goroutines := runtime.NumGoroutine()
|
||||
|
||||
res, err := instAction.RunWithContext(ctx, buildChart(), vals)
|
||||
_, err := instAction.RunWithContext(ctx, buildChart(), vals)
|
||||
is.Error(err)
|
||||
is.Contains(res.Info.Description, "Release \"interrupted-release\" failed: context canceled")
|
||||
is.Equal(res.Info.Status, release.StatusFailed)
|
||||
is.Contains(err.Error(), "context canceled")
|
||||
|
||||
is.Equal(goroutines+1, runtime.NumGoroutine()) // installation goroutine still is in background
|
||||
time.Sleep(10 * time.Second) // wait for goroutine to finish
|
||||
|
|
@ -515,8 +513,7 @@ func TestInstallRelease_Atomic_Interrupted(t *testing.T) {
|
|||
instAction.Atomic = true
|
||||
vals := map[string]interface{}{}
|
||||
|
||||
ctx := context.Background()
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
time.AfterFunc(time.Second, cancel)
|
||||
|
||||
res, err := instAction.RunWithContext(ctx, buildChart(), vals)
|
||||
|
|
|
|||
Loading…
Reference in a new issue