-
Notifications
You must be signed in to change notification settings - Fork 12
Add a test to check for machineset leftovers ports #45
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
Add a test to check for machineset leftovers ports #45
Conversation
|
Hello @itzikb-redhat I think you can move the test to servers.go file. For the files I created until now, I tried to give "openstack" perspective (servers, servergroups, volumes...) and the operation you are testing is related to the creation of a new server. What do you think? |
5192ae4 to
fc4e3c5
Compare
I think it's more related to machinesets but we can discuss |
1f7ca21 to
0e4c385
Compare
rlobillo
left a comment
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.
Great job @itzikb-redhat
I think it would be very useful in this complex testcase to make use of g.By. With this utility it is easier for maintainers to understand the different stages in the testcase. Would you mind to include them in the test? This will help for review too.
Also, in the Expect commands, it is possible to include a failure message:
o.Expect(err).NotTo(o.HaveOccurred(), "Error unmarshaling new MachineSet Specs")
I think that is very useful to get a clear view of the failure by only checking the logs.
[0] https://onsi.github.io/ginkgo/#documenting-complex-specs-by
| g.By("fetching worker machineSets") | ||
| var networkClient *gophercloud.ServiceClient | ||
| var rawBytes []byte | ||
| var t machineproviderv1.OpenstackProviderSpec |
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.
Could you please use a more descriptive name for the variable on line 47?
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
| rclient, err = runtimeclient.New(xconfig, runtimeclient.Options{}) | ||
| o.Expect(err).NotTo(o.HaveOccurred()) | ||
|
|
||
| err = machinev1.AddToScheme(scheme.Scheme) |
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.
Please include a comment stating why you need to do this (line 74).
MaysaMacedo
left a comment
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.
Is this test an outcome of a bugzilla?
| o.Expect(err).NotTo(o.HaveOccurred()) | ||
| clientSet, err = e2e.LoadClientset() | ||
| o.Expect(err).NotTo(o.HaveOccurred()) | ||
| g.By("preparing openstack client") |
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 line and the next one are unnecessary
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
| if len(machineSets) == 0 { | ||
| e2eskipper.Skipf("Expects at least one worker machineset. Found none.") | ||
| } | ||
| xconfig, err := config.GetConfig() |
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.
Is it needed to get the config again if it's already available at line 40 or it's a different one?
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 changing to e2e.LoadConfig , anyway cfg is not accessible here
| newMachinesetParams := framework.BuildMachineSetParams(rclient, 1) | ||
| rawBytes, err = json.Marshal(newMachinesetParams.ProviderSpec.Value) | ||
|
|
||
| err = json.Unmarshal(rawBytes, &t) |
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.
what t represents? a machineset?
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 modified the name to newProviderSpec, It's the providerspec of the machineset
| s, err := json.Marshal(t) | ||
| newMachinesetParams.ProviderSpec.Value.Raw = s | ||
|
|
||
| o.Expect(err).NotTo(o.HaveOccurred()) |
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 might be better to move this line to after 88 so we can easily identify which err is being checked
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
| newMachinesetParams.ProviderSpec.Value.Raw = s | ||
|
|
||
| o.Expect(err).NotTo(o.HaveOccurred()) | ||
| ms, err := framework.CreateMachineSet(rclient, newMachinesetParams) |
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.
| ms, err := framework.CreateMachineSet(rclient, newMachinesetParams) | |
| g.By("Create machineSet with new name and server group") | |
| ms, err := framework.CreateMachineSet(rclient, newMachinesetParams) |
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.
Added a similar one
|
|
||
| portID := "" | ||
| for _, port := range allPorts { | ||
| if strings.Contains(port.Name, newMachinesetParams.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.
is the name of the port exactly a fragment of the machineset name or it should be equal?
If it's equal, we could filter the ports query by that name as well
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.
The ports contains the string but it's not exact
| o.Expect(err).NotTo(o.HaveOccurred()) | ||
|
|
||
| //Delete the machineset | ||
| e2e.Logf("Waiting for 10 seconds before deleting machineset %v", ms.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.
What happens if 10 seconds was not enough to create the machine? Perhaps we should poll instead
|
@itzikb-redhat It would be good to add a comment to the code, linking that bz. Thanks |
Done |
0e4c385 to
8cc617b
Compare
8cc617b to
9e7c08b
Compare
|
/test verify |
9e7c08b to
5fe1085
Compare
|
Rebased on |
|
/retest |
|
/lgtm |
|
/retest |
|
/hold |
|
/retest |
1 similar comment
|
/retest |
|
/hold cancel |
|
/approve remove |
|
/approve cancel |
In the following test "[sig-installer][Suite:openshift/openstack] The OpenStack platform on instance creation should include the addresses on the machine specs [Suite:openshift/conformance/parallel]" it may happen that a machine that was created by another test is gone, we add a check so that only found machines are tested
64066ce to
eb55bcc
Compare
|
So "[sig-installer][Suite:openshift/openstack] The OpenStack platform on instance creation should include the addresses on the machine specs [Suite:openshift/conformance/parallel]" The updated PS should solve it for now but I wonder if the test shouldn't be modified to reflect the bug , i.e. to add a FIP to a machine and then check the addresses of the machine instead of going over all the machines |
|
@itzikb-redhat: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions 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. |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: MaysaMacedo The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/cherry-pick release-4.11 |
|
@itzikb-redhat: #45 failed to apply on top of branch "release-4.11": DetailsIn 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. |
Create a machineset with a bogus serverGroupID
Delete the machineset
Check that there is no leftover port associated with the deleted machineset