mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-04 23:17:50 +00:00
kubectl: fix sort logic for logs
Use a separate sorting algorithm for kubectl logs that sorts from older to newer instead of the other way that ActivePods is doing.
This commit is contained in:
@@ -476,12 +476,12 @@ func TestGetFirstPod(t *testing.T) {
|
||||
{
|
||||
name: "kubectl logs - two ready pods",
|
||||
podList: newPodList(2, -1, -1, labelSet),
|
||||
sortBy: func(pods []*api.Pod) sort.Interface { return controller.ActivePods(pods) },
|
||||
sortBy: func(pods []*api.Pod) sort.Interface { return controller.ByLogging(pods) },
|
||||
expected: &api.Pod{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
Name: "pod-2",
|
||||
Name: "pod-1",
|
||||
Namespace: api.NamespaceDefault,
|
||||
CreationTimestamp: unversioned.Date(2016, time.April, 1, 1, 0, 1, 0, time.UTC),
|
||||
CreationTimestamp: unversioned.Date(2016, time.April, 1, 1, 0, 0, 0, time.UTC),
|
||||
Labels: map[string]string{"test": "selector"},
|
||||
},
|
||||
Status: api.PodStatus{
|
||||
@@ -498,7 +498,7 @@ func TestGetFirstPod(t *testing.T) {
|
||||
{
|
||||
name: "kubectl logs - one unhealthy, one healthy",
|
||||
podList: newPodList(2, -1, 1, labelSet),
|
||||
sortBy: func(pods []*api.Pod) sort.Interface { return controller.ActivePods(pods) },
|
||||
sortBy: func(pods []*api.Pod) sort.Interface { return controller.ByLogging(pods) },
|
||||
expected: &api.Pod{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
Name: "pod-2",
|
||||
|
||||
Reference in New Issue
Block a user