-
Notifications
You must be signed in to change notification settings - Fork 25
Fix parse azure cloud data #756
Fix parse azure cloud data #756
Conversation
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.
Half of the lines and a test added too. Love this!
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.
🚀
log.Errorf("can't decode storage profile") | ||
return cloudData | ||
return entities.AzureCloudData{ | ||
VMName: azureMetadata.Compute.Name, |
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.
mmm, I have some doubts about this.
Could we have the scenario where some of this fields don't exist and we have some other issue.
Or they are automatically filled with empty data?
The added test doesn't cover this situation at least
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.
it should work because the fields are not pointers so it will take the golang "zero value".
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.
@arbulu89 I've added a test, i still believe it is a bit anemic and we are basically testing that golang works but we can keep it as safety helmet
This PR refactors the azure cloud data parsers function in the hosts projector to use
mapstructure
instead of manually casting the nested interface/map fields.It also adds asserts to the host projector cloud discovery handler test.
Related to: #755