Merge pull request #13085 from alex-kattathra-johnson/issue-12961

Fix race condition in TestInstallRelease_Wait_Interrupted test
pull/13164/head
Joe Julian 6 months ago committed by GitHub
commit 4278ada158
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -429,16 +429,14 @@ func TestInstallRelease_Wait_Interrupted(t *testing.T) {
instAction.Wait = true instAction.Wait = true
vals := map[string]interface{}{} vals := map[string]interface{}{}
ctx := context.Background() ctx, cancel := context.WithCancel(context.Background())
ctx, cancel := context.WithCancel(ctx)
time.AfterFunc(time.Second, cancel) time.AfterFunc(time.Second, cancel)
goroutines := runtime.NumGoroutine() goroutines := runtime.NumGoroutine()
res, err := instAction.RunWithContext(ctx, buildChart(), vals) _, err := instAction.RunWithContext(ctx, buildChart(), vals)
is.Error(err) is.Error(err)
is.Contains(res.Info.Description, "Release \"interrupted-release\" failed: context canceled") is.Contains(err.Error(), "context canceled")
is.Equal(res.Info.Status, release.StatusFailed)
is.Equal(goroutines+1, runtime.NumGoroutine()) // installation goroutine still is in background is.Equal(goroutines+1, runtime.NumGoroutine()) // installation goroutine still is in background
time.Sleep(10 * time.Second) // wait for goroutine to finish time.Sleep(10 * time.Second) // wait for goroutine to finish
@ -515,8 +513,7 @@ func TestInstallRelease_Atomic_Interrupted(t *testing.T) {
instAction.Atomic = true instAction.Atomic = true
vals := map[string]interface{}{} vals := map[string]interface{}{}
ctx := context.Background() ctx, cancel := context.WithCancel(context.Background())
ctx, cancel := context.WithCancel(ctx)
time.AfterFunc(time.Second, cancel) time.AfterFunc(time.Second, cancel)
res, err := instAction.RunWithContext(ctx, buildChart(), vals) res, err := instAction.RunWithContext(ctx, buildChart(), vals)

Loading…
Cancel
Save