Skip to content

Prevent daylight-savings-related failures in on-call management specs

Sarah Yasonik requested to merge sy-prevent-oncall-test-failures into master

What does this MR do?

Daylight savings is upon us. On-call shifts are prime for daylight-savings-related errors. We just had one recently which broke master. !55961 (merged)

We're about to have a similar error tomorrow and some more on March 26. This MR prevents that error from breaking master by switching the on-call schedules used to UTC, where they won't have any DST to worry about.

March 13 errors (day before DST change in New York):

  • ee/spec/workers/incident_management/oncall_rotations/persist_shifts_job_spec.rb:219

March 26 errors (2 days before DST change in Berlin):

  • ee/spec/graphql/resolvers/incident_management/oncall_shifts_resolver_spec.rb:24
  • ee/spec/workers/incident_management/oncall_rotations/persist_shifts_job_spec.rb:84
  • ee/spec/services/incident_management/oncall_shifts/read_service_spec.rb[1:1:8:1:1]
  • ee/spec/services/incident_management/oncall_shifts/read_service_spec.rb[1:1:8:3:1]

The fix in this MR isn't perfect, and I'll follow-up with something more robust per !55961 (comment 524015289) next week, but we're now in crunch time as this error will break master tomorrow.

Testing

Recording how I checked this for posterity:

  1. Update local date/time on the machine (to avoid duplicate travel_to in the specs)
  2. Run both BE & FE tests covering on-call schedules.
  3. Run again for each of March 12-15, March 26-29, April 2-5 during the 1700 UTC hour
  4. Run again for each of March 13, March 27, April 3 during the 0300 UTC hour

yarn install && yarn jest ./ee/spec/frontend/oncall_schedule

spring stop && bundle exec spring rspec ./ee/spec/models/incident_management ./ee/spec/policies/incident_management ./ee/spec/requests/api/graphql/mutations/incident_management ./ee/spec/finders/incident_management ./ee/spec/graphql/types/incident_management ./ee/spec/graphql/mutations/incident_management ./ee/spec/graphql/resolvers/incident_management ./ee/spec/lib/incident_management/oncall_shift_generator_spec.rb ./ee/spec/workers/incident_management ./ee/spec/controllers/projects/incident_management/oncall_schedules_controller_spec.rb ./ee/spec/services/incident_management

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Sarah Yasonik

Merge request reports