Skip to content

Commit

Permalink
Merge pull request #9 from grafana/fix-missing-tzdata-in-tests
Browse files Browse the repository at this point in the history
Add go internal tzdata during tests
  • Loading branch information
jotdl authored Apr 24, 2024
2 parents 736d4d8 + 2162186 commit 7107d9d
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions pkg/icassigner/calendar/ical_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,26 @@ import (
"net/http/httptest"
"testing"
"time"

_ "time/tzdata"
)

func TestIsEventBlockingAvailability(t *testing.T) {
now := time.Now()

utc, _ := time.LoadLocation("utc")
usa, _ := time.LoadLocation("America/New_York")
australia, _ := time.LoadLocation("Australia/Melbourne")
utc, err := time.LoadLocation("UTC")
if err != nil {
t.Fatal("Error during timezone utc loading:", err)
}
usa, err := time.LoadLocation("America/New_York")
if err != nil {
t.Fatal("Error during timezone usa loading:", err)
}

australia, err := time.LoadLocation("Australia/Melbourne")
if err != nil {
t.Fatal("Error during timezone melbourne loading:", err)
}

testCases := []struct {
name string
Expand Down Expand Up @@ -215,7 +227,7 @@ END:VCALENDAR`
}))
defer ts.Close()

loc, _ := time.LoadLocation("utc")
loc, _ := time.LoadLocation("UTC")
now := time.Date(2023, time.December, 07, 16, 0, 0, 0, loc)

r, err := CheckAvailability(ts.URL, "tester", now)
Expand Down

0 comments on commit 7107d9d

Please sign in to comment.