fix(helm): Sort executing hooks based on weight

When performing helm tests with the --logs option, the logs should be retrieved in the order dictated by the hook weight. This is to evade a situation where helm will try to retrieve logs from a pod that hasn't started due to a failure in an earlier test

Closes #10018

Signed-off-by: Nermin Sehovic <nermin-s@live.dk>
pull/10516/head
Nermin Sehovic 4 years ago
parent bf68c70d2f
commit a53fb29e3c

@ -20,6 +20,7 @@ import (
"context" "context"
"fmt" "fmt"
"io" "io"
"sort"
"time" "time"
"github.com/pkg/errors" "github.com/pkg/errors"
@ -94,6 +95,8 @@ func (r *ReleaseTesting) GetPodLogs(out io.Writer, rel *release.Release) error {
executingHooks = rel.Hooks executingHooks = rel.Hooks
} }
sort.Stable(hookByWeight(executingHooks))
for _, h := range executingHooks { for _, h := range executingHooks {
for _, e := range h.Events { for _, e := range h.Events {
if e == release.HookTest { if e == release.HookTest {

Loading…
Cancel
Save