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
OpenStack: Add Unit Tests for validation of platform.openstack.machineSubnet #4937
OpenStack: Add Unit Tests for validation of platform.openstack.machineSubnet #4937
Conversation
@gyohuangxin: This pull request references Bugzilla bug 1957809, which is invalid:
Comment In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
de467cf
to
9dfd25b
Compare
/retest |
1 similar comment
/retest |
@mandre Could you review this? Thanks. |
/retest |
5 similar comments
/retest |
/retest |
/retest |
/retest |
/retest |
networking: func() *types.Networking { | ||
n := validNetworking() | ||
cidr := ipnet.IPNet{ | ||
net.IPNet{ |
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.
ditto
@@ -49,9 +49,6 @@ func validateMachinesSubnet(p *openstack.Platform, n *types.Networking, ci *Clou | |||
} | |||
} | |||
|
|||
if len(p.ExternalDNS) > 0 && p.MachinesSubnet != "" { |
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.
Nit: this is unrelated to the topic of your commit which is to add unit tests.
Ideally you would make this change in a separate commit (in the same PR) and explain why it's OK to remove the validation and perhaps link to the other validation that already covers that case in your commit message.
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.
Thanks! I've put it into a new commit and explain the reason in commit message.
cidr := ipnet.IPNet{ | ||
net.IPNet{ | ||
IP: net.IPv4(172, 0, 0, 1), | ||
Mask: net.IPv4Mask(255, 255, 255, 0), | ||
}, | ||
} | ||
machineNetworkEntry := &types.MachineNetworkEntry{ | ||
CIDR: cidr, | ||
} |
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.
This causes govet to fail:
pkg/asset/installconfig/openstack/validation/platform_test.go:405:13: github.com/openshift/installer/pkg/ipnet.IPNet composite literal uses unkeyed fields
pkg/asset/installconfig/openstack/validation/platform_test.go:436:13: github.com/openshift/installer/pkg/ipnet.IPNet composite literal uses unkeyed fields
Try this:
cidr := ipnet.IPNet{ | |
net.IPNet{ | |
IP: net.IPv4(172, 0, 0, 1), | |
Mask: net.IPv4Mask(255, 255, 255, 0), | |
}, | |
} | |
machineNetworkEntry := &types.MachineNetworkEntry{ | |
CIDR: cidr, | |
} | |
machineNetworkEntry := &types.MachineNetworkEntry{ | |
CIDR: *ipnet.MustParseCIDR("172.0.0.1/24"), | |
} |
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.
Thanks so much, it confused me for a long time. Let's wait and see:)
This link to another validation already covers the case that both p.MachineSubnet and p.ExternalDNS are not nil, so we remove the duplicate validation. https://github.com/openshift/installer/blob/6d5a001/pkg/asset/installconfig/openstack/validation/platform.go#L41-L43
9dfd25b
to
b750bfd
Compare
/retest |
2 similar comments
/retest |
/retest |
/retitle OpenStack: Add Unit Tests for validation of platform.openstack.machineSubnet |
@gyohuangxin: No Bugzilla bug is referenced in the title of this pull request. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
We're currently having issues with our e2e-openstack, let's use e2e-openstack-ipi instead |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mandre The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest |
@mandre Hi, all tests except e2e-openstack has passed. Can you merge this? Thanks! |
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
Thanks for the patch 🎉
/retest Please review the full test history for this PR and help us cut down flakes. |
4 similar comments
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
@gyohuangxin: The following test failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
installer/pkg/asset/installconfig/openstack/validation/platform.go
Lines 52 to 54 in aba6041