Commit 7c4b9234 authored by Vitali Tatarintev's avatar Vitali Tatarintev

Properly parse time in alert payload

https://gitlab.com/gitlab-org/gitlab/-/issues/321304

Properly parse time passed as time in seconds in alert payload

Changelog: fixed
parent 2268d9f2
......@@ -193,7 +193,7 @@ module Gitlab
def parse_time(value)
Time.parse(value).utc
rescue ArgumentError
rescue ArgumentError, TypeError
end
def parse_integer(value)
......
......@@ -89,6 +89,12 @@ RSpec.describe Gitlab::AlertManagement::Payload::Base do
it { is_expected.to be_nil }
end
context 'with time in seconds' do
let(:raw_payload) { { 'test' => 1618877936 } }
it { is_expected.to be_nil }
end
end
context 'with an integer type provided' do
......
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