Skip to content

Commit

Permalink
fix(e2e): Get the most recent pod in e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gansheer committed Sep 11, 2024
1 parent 2010b81 commit 3576a67
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions e2e/support/test_support.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import (
"reflect"
"regexp"
"runtime/debug"
"sort"
"strings"
"sync"
"testing"
Expand Down Expand Up @@ -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]
}
}
Expand Down

0 comments on commit 3576a67

Please sign in to comment.