Closed mquhuy closed 4 months ago
Hi @mquhuy. Thanks for your PR.
I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test
on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.
Once the patch is verified, the new status will be reflected by the ok-to-test
label.
I understand the commands that are listed here.
Name | Link |
---|---|
Latest commit | dabce293a11d9d12b65bf7a6f25241e2cdddd7f3 |
Latest deploy log | https://app.netlify.com/sites/kubernetes-sigs-cluster-api-openstack/deploys/664ef05dec2d4d0009e3c25e |
Deploy Preview | https://deploy-preview-2081--kubernetes-sigs-cluster-api-openstack.netlify.app |
Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
/ok-to-test
/retest
/cc @mdbooth
Thank you @mdbooth! I have to go now, but I'll make the change asap tomorrow.
e2e test failures look like an infra-flake. test failures are most likely missing mock calls for the new delete subports flow.
Incidentally, I didn't check but I was assuming that because this is specifically in the Trunk delete flow we've already checked that trunks are expected, and therefore we're not making unnecessary OpenStack API calls for the majority of folks who aren't using trunks.
If this is the case, and the failing tests don't really need trunks, it might be simpler to update the test input object to disable trunks rather than adding trunk calls to the expected mocks.
I used this PR as a test for junit formatting if you want to look at something a bit prettier: https://prow.k8s.io/view/gs/kubernetes-jenkins/pr-logs/pull/kubernetes-sigs_cluster-api-provider-openstack/2095/pull-cluster-api-provider-openstack-test/1792498916650913792
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: mdbooth
The full list of commands accepted by this bot can be found here.
The pull request process is described here
I'm happy to merge this, but I recommend considering how best to test it. Some unit tests covering error cases might be one way. I think (but I haven't checked) we create a port with a trunk in one of the e2e tests. Perhaps we could also add a subport to it, which would cause the test to fail if it isn't cleaned up properly. Just some ideas.
Thank you. I'm wondering if this is the one you were thinking of? https://github.com/kubernetes-sigs/cluster-api-provider-openstack/blob/main/pkg/cloud/services/networking/port_test.go#L309
I'm not sure if I understand it correctly, but it seems to me the test is only checking if the port could be created. Do you think we should also test if it can be cleaned? If it turned out to be in a bigger scope, I'd be happy to do it in another PR.
/unhold
I'm happy to merge this, but I recommend considering how best to test it. Some unit tests covering error cases might be one way. I think (but I haven't checked) we create a port with a trunk in one of the e2e tests. Perhaps we could also add a subport to it, which would cause the test to fail if it isn't cleaned up properly. Just some ideas.
Thank you. I'm wondering if this is the one you were thinking of? https://github.com/kubernetes-sigs/cluster-api-provider-openstack/blob/main/pkg/cloud/services/networking/port_test.go#L309
I'm not sure if I understand it correctly, but it seems to me the test is only checking if the port could be created. Do you think we should also test if it can be cleaned? If it turned out to be in a bigger scope, I'd be happy to do it in another PR.
Looks like that's only testing port creation. You might want a new unit test for the delete flow. But something similar to that.
For the e2e test I was thinking of this: https://github.com/kubernetes-sigs/cluster-api-provider-openstack/blob/046d6b7c9c7df3f6a514dd452d65922ea7156c92/test/e2e/suites/e2e/e2e_test.go#L447-L455 If we updated the test to add a subport to that trunk we'd presumably get an error if the test didn't clean it up properly.
/cherrypick release-0.9 /cherrypick release-0.10
@mquhuy: only kubernetes-sigs org members may request cherry picks. If you are already part of the org, make sure to change your membership to public. Otherwise you can still do the cherry-pick manually.
What this PR does / why we need it: Sometimes, when a trunk is associated with sub ports, deletion of the trunk will not lead to deletion of the subports, which is not expected. This PR adds the check to ensure the deletion of the subports in such cases.
Special notes for your reviewer:
TODOs:
/hold