Skip to content

Commit 3d266dd

Browse files
authored
In TestViewRepo2, convert computed timezones to local time (#24579)
This fixes up #10446; in that, the *expected* timezone was changed to the local timezone, but the computed timezone was left in UTC. The result was this failure, when run on a non-UTC system: ``` Diff: --- Expected +++ Actual @@ -5,3 +5,3 @@ commitMsg: (string) (len=12) "init project", - commitTime: (string) (len=29) "Wed, 14 Jun 2017 09:54:21 EDT" + commitTime: (string) (len=29) "Wed, 14 Jun 2017 13:54:21 UTC" }, @@ -11,3 +11,3 @@ commitMsg: (string) (len=12) "init project", - commitTime: (string) (len=29) "Wed, 14 Jun 2017 09:54:21 EDT" + commitTime: (string) (len=29) "Wed, 14 Jun 2017 13:54:21 UTC" } Test: TestViewRepo2 ``` I assume this was probably missed since the CI servers all run in UTC? The Format() string "Mon, 02 Jan 2006 15:04:05 UTC" was incorrect: 'UTC' isn't recognized as a variable placeholder, but was just being copied verbatim. It should use 'MST' in order to command Format() to output the attached timezone, which is what `time.RFC1123` has.
1 parent f5b70a0 commit 3d266dd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tests/integration/repo_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func testViewRepo(t *testing.T) {
7878
// convert "2017-06-14 21:54:21 +0800" to "Wed, 14 Jun 2017 13:54:21 UTC"
7979
htmlTimeString, _ := s.Find("relative-time.time-since").Attr("datetime")
8080
htmlTime, _ := time.Parse(time.RFC3339, htmlTimeString)
81-
f.commitTime = htmlTime.UTC().Format("Mon, 02 Jan 2006 15:04:05 UTC")
81+
f.commitTime = htmlTime.In(time.Local).Format(time.RFC1123)
8282
items = append(items, f)
8383
})
8484

0 commit comments

Comments
 (0)