From 1d977105c0dab4fbfe9b872aae9931f2ac8f067d Mon Sep 17 00:00:00 2001 From: ashmrtn Date: Tue, 29 Nov 2022 09:51:34 -0800 Subject: [PATCH] Fix bad comparison due to timezone mismatch (#1627) ## Description Exchange stores start/end times for events in UTC time. This fixes test failures due to comparing hours extracted from time structs directly. Without the normalization to UTC, the initial time may be different. ## Type of change - [ ] :sunflower: Feature - [x] :bug: Bugfix - [ ] :world_map: Documentation - [x] :robot: Test - [ ] :computer: CI/Deployment - [ ] :hamster: Trivial/Minor ## Issue(s) * closes #1625 ## Test Plan - [x] :muscle: Manual - [x] :zap: Unit test - [ ] :green_heart: E2E --- src/internal/connector/exchange/event_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/internal/connector/exchange/event_test.go b/src/internal/connector/exchange/event_test.go index 97ebf0acc..386f451ab 100644 --- a/src/internal/connector/exchange/event_test.go +++ b/src/internal/connector/exchange/event_test.go @@ -26,7 +26,9 @@ func TestEventSuite(t *testing.T) { // TestEventInfo verifies that searchable event metadata // can be properly retrieved from a models.Eventable object func (suite *EventSuite) TestEventInfo() { - initial := time.Now() + // Exchange stores start/end times in UTC and the below compares hours + // directly so we need to "normalize" the timezone here. + initial := time.Now().UTC() now := common.FormatTimeWith(initial, common.M365DateTimeTimeZone) suite.T().Logf("Initial: %v\nFormatted: %v\n", initial, now)