From 3ad92bad2ea599151fec194caad7affc09837902 Mon Sep 17 00:00:00 2001 From: Daniel Steele <218190424+keeltrace@users.noreply.github.com> Date: Tue, 8 Sep 2026 18:19:08 -0700 Subject: [PATCH 1/2] cli/image: make history test timezone-independent Signed-off-by: Daniel Steele <218190424+keeltrace@users.noreply.github.com> --- cli/command/image/history_test.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cli/command/image/history_test.go b/cli/command/image/history_test.go index f130821000ff..4071bdf0b97c 100644 --- a/cli/command/image/history_test.go +++ b/cli/command/image/history_test.go @@ -52,6 +52,12 @@ func TestNewHistoryCommandErrors(t *testing.T) { } func TestNewHistoryCommandSuccess(t *testing.T) { + local := time.Local + time.Local = time.UTC + t.Cleanup(func() { + time.Local = local + }) + testCases := []struct { name string args []string @@ -118,9 +124,6 @@ func TestNewHistoryCommandSuccess(t *testing.T) { } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - // Set to UTC timezone as timestamps in output are - // printed in the current timezone - t.Setenv("TZ", "UTC") cli := test.NewFakeCli(&fakeClient{imageHistoryFunc: tc.imageHistoryFunc}) cmd := newHistoryCommand(cli) cmd.SetOut(io.Discard) From d83935a4aea69fa5954159a90faeb347f7d79c21 Mon Sep 17 00:00:00 2001 From: KeelTrace <218190424+keeltrace@users.noreply.github.com> Date: Wed, 9 Sep 2026 07:08:00 -0700 Subject: [PATCH 2/2] test: keep timezone rationale with setup --- cli/command/image/history_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cli/command/image/history_test.go b/cli/command/image/history_test.go index 4071bdf0b97c..50a1fa8e8262 100644 --- a/cli/command/image/history_test.go +++ b/cli/command/image/history_test.go @@ -52,6 +52,8 @@ func TestNewHistoryCommandErrors(t *testing.T) { } func TestNewHistoryCommandSuccess(t *testing.T) { + // Set to UTC timezone as timestamps in output are + // printed in the current timezone local := time.Local time.Local = time.UTC t.Cleanup(func() {