Commit 25f1b3ac authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch '229174_use_unix_time_for_jira_update_sequence_id' into 'master'

Change Jira Connect update sequence id to use Unix Time

See merge request gitlab-org/gitlab!51697
parents 322336c3 409a16ba
---
title: Change Jira Connect update sequence id to use Unix Time
merge_request: 51697
author:
type: fixed
......@@ -4,7 +4,7 @@ module Atlassian
module JiraConnect
class Client < Gitlab::HTTP
def self.generate_update_sequence_id
Gitlab::Metrics::System.monotonic_time.to_i
(Time.now.utc.to_f * 1000).round
end
def initialize(base_uri, shared_secret)
......
......@@ -18,15 +18,15 @@ RSpec.describe Atlassian::JiraConnect::Client do
end
end
around do |example|
freeze_time { example.run }
end
describe '.generate_update_sequence_id' do
it 'returns monotonic_time converted it to integer' do
allow(Gitlab::Metrics::System).to receive(:monotonic_time).and_return(1.0)
it 'returns unix time in microseconds as integer', :aggregate_failures do
travel_to(Time.utc(1970, 1, 1, 0, 0, 1)) do
expect(described_class.generate_update_sequence_id).to eq(1000)
end
expect(described_class.generate_update_sequence_id).to eq(1)
travel_to(Time.utc(1970, 1, 1, 0, 0, 5)) do
expect(described_class.generate_update_sequence_id).to eq(5000)
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment