You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by gf...@apache.org on 2024/09/11 09:11:11 UTC

(camel-k) 01/03: fix(e2e): Get the most recent pod in e2e tests

This is an automated email from the ASF dual-hosted git repository.

gfournier pushed a commit to branch release-2.4.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 3576a672ef04681afe470dabce9706301a19be03
Author: Gaelle Fournier <ga...@gmail.com>
AuthorDate: Mon Sep 2 18:08:01 2024 +0200

    fix(e2e): Get the most recent pod in e2e tests
---
 e2e/support/test_support.go | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/e2e/support/test_support.go b/e2e/support/test_support.go
index 4f2c59b04..f6025e748 100644
--- a/e2e/support/test_support.go
+++ b/e2e/support/test_support.go
@@ -36,6 +36,7 @@ import (
 	"reflect"
 	"regexp"
 	"runtime/debug"
+	"sort"
 	"strings"
 	"sync"
 	"testing"
@@ -546,6 +547,10 @@ func IntegrationPod(t *testing.T, ctx context.Context, ns string, name string) f
 		if len(pods) == 0 {
 			return nil
 		}
+
+		sort.SliceStable(pods, func(i, j int) bool {
+			return pods[i].GetCreationTimestamp().Time.After(pods[j].GetCreationTimestamp().Time)
+		})
 		return &pods[0]
 	}
 }