-
Notifications
You must be signed in to change notification settings - Fork 321
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 acceptance test cleanup #3375
Conversation
4ff0b61
to
fa98d44
Compare
Just a heads up that we're entering a code-freeze today at some point (for the backports) so maybe hold off on merging until you check with @t-eckert |
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.
Awesome job!
I am hopeful that this will help with some of those "resources still exist" errors 🤞
@@ -222,6 +223,66 @@ func (h *HelmCluster) Destroy(t *testing.T) { | |||
} | |||
} | |||
|
|||
// Delete any deployments that have h.releaseName in their name. | |||
deployments, err := h.kubernetesClient.AppsV1().Deployments(h.helmOptions.KubectlOptions.Namespace).List(context.Background(), metav1.ListOptions{LabelSelector: "release=" + h.releaseName}) |
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.
suggestion: Just a thought but might be worth having a function or something that we call that just generates "release="+h.releaseName
since it's used everywhere. Less chance of accidentally mispelling/creating wrong string in the future.
@@ -286,6 +347,51 @@ func (h *HelmCluster) Destroy(t *testing.T) { | |||
} | |||
} | |||
|
|||
// Verify that all deployments have been deleted. | |||
deployments, err = h.kubernetesClient.AppsV1().Deployments(h.helmOptions.KubectlOptions.Namespace).List(context.Background(), metav1.ListOptions{LabelSelector: "release=" + h.releaseName}) |
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.
are there any steps we can take if these resources still exist?
require.NoError(r, err) | ||
for _, deployment := range deployments.Items { | ||
if strings.Contains(deployment.Name, h.releaseName) { | ||
r.Errorf("Found deployment which should have been deleted: %s", deployment.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.
Good idea to verify resource deletion... this will hopefully help us diagnose which resource is causing things not to be deleted properly in the future.
I will wait until after code freeze to merge this just so that we do not cause any problems. |
Ack. |
Add acceptance test cleanup
fa98d44
to
a34177a
Compare
Changes proposed in this PR
How I've tested this PR
How I expect reviewers to test this PR
👀
Checklist