Skip to content

Fix JIRA client spec failing due to time differences

Stan Hu requested to merge sh-fix-jira-spec into master

What does this MR do and why?

Jobs such as https://gitlab.com/gitlab-org/gitlab-foss/-/jobs/1686583500 were intermittently failing because the Authorization header would have slightly different JWTs. It turns out the iat and exp fields were off by a second since the test might generate the field before the test made the HTTP request.

We fix this issue by freezing the time whenever we need to make an HTTP request.

Screenshots or screen recordings

Example JWT discrepancy:

Actual

{
  "iss": "gitlab-jira-connect-localhost",
  "iat": 1634490113,
  "exp": 1634490173,
  "qsh": "0947f5bc05f2c4728bc2e3905089951a4aa601772a79268aa983e2ef881b79ff"
}

Expected

{
  "iss": "gitlab-jira-connect-localhost",
  "iat": 1634490114,
  "exp": 1634490174,
  "qsh": "0947f5bc05f2c4728bc2e3905089951a4aa601772a79268aa983e2ef881b79ff"
}

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Stan Hu

Merge request reports