-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix started_at/finished_at always being nil #496
Fix started_at/finished_at always being nil #496
Conversation
@Fryguy Is it possible to raise the priority of this bugfix? Or are we thinking the deleted_on logic is not critical? |
@@ -114,7 +114,7 @@ def assert_specific_container | |||
@container.last_started_at, | |||
@container.last_finished_at, | |||
].each do |date_| | |||
expect(date_.kind_of?(ActiveSupport::TimeWithZone) || date_.kind_of?(NilClass)).to be_truthy | |||
expect(date_.kind_of?(ActiveSupport::TimeWithZone)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this change intentional? This expectation is no longer expecting anything?
expect(date_.kind_of?(ActiveSupport::TimeWithZone)) | |
expect(date_.kind_of?(ActiveSupport::TimeWithZone)).to be |
or
expect(date_.kind_of?(ActiveSupport::TimeWithZone)) | |
expect(date_.kind_of?(ActiveSupport::TimeWithZone)).to be_truthy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm actually just going to drop the whole loop since expect time or nil
is what hid this bug in the first place
In this VCR @container
has started_at
, last_started_at
and last_finished_at
set wit finished_at
being nil
so we can just check those directly
@@ -853,10 +853,10 @@ def parse_container_state(state_hash) | |||
return {} if state_hash.to_h.empty? | |||
res = {} | |||
# state_hash key is the state and value are attributes e.g 'running': {...} | |||
(state, state_info), = state_hash.to_h.to_a | |||
(state, state_info), = state_hash.to_h.deep_symbolize_keys.to_a | |||
res[:state] = state | |||
%w(reason started_at finished_at exit_code signal message).each do |attr| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe not for this PR, but we can pre-symbolize everything and not need to the .to_sym nor camelize calls calls - Something like:
%w(reason started_at finished_at exit_code signal message).each do |attr| | |
%i(reason reason started_at startedAt finished_at finishedAt exit_code exitCode signal signal message message).each_slice(2) do |attr, state_info_attr| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea, instead of each_slice, just using a hash is easier for me to read. But both work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@kbrock we'll backport to petrosian as part of the set, yes. Even so, we'll need to deal with existing records anyway. |
f1fcc7a
to
0d96172
Compare
0d96172
to
731d077
Compare
The `state_info` had symbol keys like `:startedAt` and `:finishedAt` and we were looking for string keys like `"startedAt"` and `"finishedAt"` causing these values to always be `nil` even if data existed in the API response.
731d077
to
634e763
Compare
Checked commit agrare@634e763 with ruby 2.6.10, rubocop 1.28.2, haml-lint 0.35.0, and yamllint |
Rebase please. I think kubernetes HEAD fixes this issue |
Backported to
|
…amps Fix started_at/finished_at always being nil (cherry picked from commit 1c753fe)
The
state_info
had symbol keys like:startedAt
and:finishedAt
and we were looking for string keys like"startedAt"
and"finishedAt"
causing these values to always benil
even if data existed in the API response.