-
Notifications
You must be signed in to change notification settings - Fork 373
Conversation
reflect.DeepEqual would return false when comparing nil map/slice with empty map/slice. We would want to return success in such case, since it is possible for upper layers to send these kind of configs. Fixes: kata-containers#844 Signed-off-by: Peng Tao <[email protected]>
/test |
@@ -100,6 +100,71 @@ func resetHypervisorConfig(config *vc.VMConfig) { | |||
config.ProxyConfig = vc.ProxyConfig{} | |||
} | |||
|
|||
func compareStruct(foo, bar reflect.Value) bool { | |||
for i := 0; i < foo.NumField(); i++ { |
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.
Missing check on field counts for foo
and bar
? They might compare as the same but if bar
has extra fields that would be incorrect surely?
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.
They have to pass foo.Type() == bar.Type()
so they must be of the same struct type.
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.
Ah - good point!
Codecov Report
@@ Coverage Diff @@
## master #845 +/- ##
=========================================
Coverage ? 69.29%
=========================================
Files ? 88
Lines ? 13436
Branches ? 0
=========================================
Hits ? 9310
Misses ? 3240
Partials ? 886 |
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.
lgtm
1 similar comment
/retest |
Still seeing network timeouts. /test |
CI green now. |
reflect.DeepEqual would return false when comparing nil map/slice with
empty map/slice. We would want to return success in such case, since it
is possible for upper layers to send these kind of configs.
Fixes: #844