Skip to content

Commit 6bf73a5

Browse files
authored
fix(coderd): move test location to ignore Australia time saving error (coder#15013)
A test is currently failing because it relies on Sidney Tz. from the internet : ``` Daylight Saving Time begins at 2 am (AEST) on the first Sunday in October and ends at 3 am (Australian Eastern Daylight Time) on the first Sunday in April. ``` Due to that - there's one hour missing in the tests - and the test `6 days are acceptable` is failing. Changing to another timezone to fix the situation, it would require a longer-term solution or making sure it cannot happen anymore.
1 parent 3046f5c commit 6bf73a5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

coderd/insights_internal_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -179,17 +179,17 @@ func Test_parseInsightsInterval_week(t *testing.T) {
179179
t.Parallel()
180180

181181
layout := insightsTimeLayout
182-
sydneyLoc, err := time.LoadLocation("Australia/Sydney") // Random location
182+
losAngelesLoc, err := time.LoadLocation("America/Los_Angeles") // Random location
183183
require.NoError(t, err)
184184

185-
now := time.Now().In(sydneyLoc)
185+
now := time.Now().In(losAngelesLoc)
186186
t.Logf("now: %s", now)
187187

188188
y, m, d := now.Date()
189-
today := time.Date(y, m, d, 0, 0, 0, 0, sydneyLoc)
189+
today := time.Date(y, m, d, 0, 0, 0, 0, losAngelesLoc)
190190
t.Logf("today: %s", today)
191191

192-
thisHour := time.Date(y, m, d, now.Hour(), 0, 0, 0, sydneyLoc)
192+
thisHour := time.Date(y, m, d, now.Hour(), 0, 0, 0, losAngelesLoc)
193193
t.Logf("thisHour: %s", thisHour)
194194
twoHoursAgo := thisHour.Add(-2 * time.Hour)
195195
t.Logf("twoHoursAgo: %s", twoHoursAgo)

0 commit comments

Comments
 (0)