From a53fb29e3c6bf392083191e032e48d52b94f1b69 Mon Sep 17 00:00:00 2001 From: Nermin Sehovic Date: Mon, 3 Jan 2022 00:07:50 +0100 Subject: [PATCH] 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 --- pkg/action/release_testing.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/action/release_testing.go b/pkg/action/release_testing.go index b50d18140..9a4f626c5 100644 --- a/pkg/action/release_testing.go +++ b/pkg/action/release_testing.go @@ -20,6 +20,7 @@ import ( "context" "fmt" "io" + "sort" "time" "github.com/pkg/errors" @@ -94,6 +95,8 @@ func (r *ReleaseTesting) GetPodLogs(out io.Writer, rel *release.Release) error { executingHooks = rel.Hooks } + sort.Stable(hookByWeight(executingHooks)) + for _, h := range executingHooks { for _, e := range h.Events { if e == release.HookTest {