mirror of https://github.com/docker/cli.git
un-skip history test and fix golden mismatches
Signed-off-by: Jason Hall <jason@chainguard.dev>
This commit is contained in:
parent
edd51b2288
commit
f5e224e940
|
@ -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,13 +96,16 @@ func TestNewHistoryCommandSuccess(t *testing.T) {
|
|||
},
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
cli := test.NewFakeCli(&fakeClient{imageHistoryFunc: tc.imageHistoryFunc})
|
||||
cmd := NewHistoryCommand(cli)
|
||||
cmd.SetOut(io.Discard)
|
||||
cmd.SetArgs(tc.args)
|
||||
err := cmd.Execute()
|
||||
assert.NilError(t, err)
|
||||
actual := cli.OutBuffer().String()
|
||||
golden.Assert(t, actual, fmt.Sprintf("history-command-success.%s.golden", tc.name))
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
cli := test.NewFakeCli(&fakeClient{imageHistoryFunc: tc.imageHistoryFunc})
|
||||
cmd := NewHistoryCommand(cli)
|
||||
cmd.SetOut(io.Discard)
|
||||
cmd.SetArgs(tc.args)
|
||||
err := cmd.Execute()
|
||||
assert.NilError(t, err)
|
||||
actual := cli.OutBuffer().String()
|
||||
golden.Assert(t, actual, fmt.Sprintf("history-command-success.%s.golden", tc.name))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
IMAGE CREATED AT CREATED BY SIZE COMMENT
|
||||
abcdef 2017-01-01T12:00:03Z rose 0 new history item!
|
||||
IMAGE CREATED AT CREATED BY SIZE COMMENT
|
||||
abcdef 2017-01-01T12:00:03Z rose 0 new history item!
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
IMAGE CREATED CREATED BY SIZE COMMENT
|
||||
123456789012 Less than a second ago 0B
|
||||
IMAGE CREATED CREATED BY SIZE COMMENT
|
||||
123456789012 Less than a second ago 0B
|
||||
|
|
Loading…
Reference in New Issue