-
Notifications
You must be signed in to change notification settings - Fork 39.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
For get, condense completions and success into a single column, and print the job duration. Use a new variant of ShortHumanDuration that shows more significant digits, since duration matters more for jobs. ``` NAME COMPLETIONS DURATION AGE image-mirror-origin-v3.10-1529985600 1/1 47s 42m image-mirror-origin-v3.11-1529985600 1/1 74s 42m image-pruner-1529971200 1/1 60m 4h ``` The completions column can be: ``` COMPLETIONS 0/1 # completions nil or 1, succeeded 0 1/1 # completions nil or 1, succeeded 1 0/3 # completions 3, succeeded 1 1/3 # completions 3, succeeded 1 0/1 of 30 # parallelism of 30, completions is nil ``` Update describe to show the completion time and the duration.
- Loading branch information
1 parent
93055c7
commit c819a16
Showing
6 changed files
with
152 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
staging/src/k8s.io/apimachinery/pkg/util/duration/duration_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
Copyright 2018 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package duration | ||
|
||
import ( | ||
"testing" | ||
"time" | ||
) | ||
|
||
func TestHumanDuration(t *testing.T) { | ||
tests := []struct { | ||
d time.Duration | ||
want string | ||
}{ | ||
{d: time.Second, want: "1s"}, | ||
{d: 70 * time.Second, want: "70s"}, | ||
{d: 190 * time.Second, want: "3m10s"}, | ||
{d: 70 * time.Minute, want: "70m"}, | ||
{d: 47 * time.Hour, want: "47h"}, | ||
{d: 49 * time.Hour, want: "2d1h"}, | ||
{d: (8*24 + 2) * time.Hour, want: "8d"}, | ||
{d: (367 * 24) * time.Hour, want: "367d"}, | ||
{d: (365*2*24 + 25) * time.Hour, want: "2y1d"}, | ||
{d: (365*8*24 + 2) * time.Hour, want: "8y"}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.d.String(), func(t *testing.T) { | ||
if got := HumanDuration(tt.d); got != tt.want { | ||
t.Errorf("HumanDuration() = %v, want %v", got, tt.want) | ||
} | ||
}) | ||
} | ||
} |