mirror of https://github.com/docker/cli.git
un-skip history test and fix golden mismatches
Signed-off-by: Jason Hall <jason@chainguard.dev>
(cherry picked from commit f5e224e940
)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
cdd81d6559
commit
28a08a22b9
|
@ -44,12 +44,15 @@ func TestNewHistoryCommandErrors(t *testing.T) {
|
|||
}
|
||||
|
||||
func notUTCTimezone() bool {
|
||||
now := time.Now()
|
||||
return now != now.UTC()
|
||||
if _, offset := time.Now().Zone(); offset != 0 {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func TestNewHistoryCommandSuccess(t *testing.T) {
|
||||
skip.If(t, notUTCTimezone, "expected output requires UTC timezone")
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
args []string
|
||||
|
@ -93,6 +96,8 @@ func TestNewHistoryCommandSuccess(t *testing.T) {
|
|||
},
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
cli := test.NewFakeCli(&fakeClient{imageHistoryFunc: tc.imageHistoryFunc})
|
||||
cmd := NewHistoryCommand(cli)
|
||||
cmd.SetOut(io.Discard)
|
||||
|
@ -101,5 +106,6 @@ func TestNewHistoryCommandSuccess(t *testing.T) {
|
|||
assert.NilError(t, err)
|
||||
actual := cli.OutBuffer().String()
|
||||
golden.Assert(t, actual, fmt.Sprintf("history-command-success.%s.golden", tc.name))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue