openshift / openshift/oadp-operator
Test workloads may not clean up properly after each test
Open
Nobody has claimed this yet.
CI
lifecycle/frozen
- Dominant language
- Go
- Stars
- 92
- Forks
- 93
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 43
Description
https://github.com/openshift/oadp-operator/pull/1223
reportAfterEach which contained cleanup code was refactored recently and maybe some bugs were added?
var _ = ReportAfterEach(func(report SpecReport) {
if report.State == types.SpecStateSkipped || report.State == types.SpecStatePending {
// do not run if the test is skipped
return
}
GinkgoWriter.Println("Report after each: state: ", report.State.String())
if report.Failed() {
// print namespace error events for app namespace
if lastBRCase.ApplicationNamespace != "" {
GinkgoWriter.Println("Printing app namespace events")
PrintNamespaceEventsAfterTime(kubernetesClientForSuiteRun, lastBRCase.ApplicationNamespace, lastInstallTime)
}
GinkgoWriter.Println("Printing oadp namespace events")
PrintNamespaceEventsAfterTime(kubernetesClientForSuiteRun, namespace, lastInstallTime)
baseReportDir := artifact_dir + "/" + report.LeafNodeText
err := os.MkdirAll(baseReportDir, 0755)
Expect(err).NotTo(HaveOccurred())
err = SavePodLogs(kubernetesClientForSuiteRun, namespace, baseReportDir)
Expect(err).NotTo(HaveOccurred())
err = SavePodLogs(kubernetesClientForSuiteRun, lastBRCase.ApplicationNamespace, baseReportDir)
Expect(err).NotTo(HaveOccurred())
}
// remove app namespace if leftover (likely previously failed before reaching uninstall applications) to clear items such as PVCs which are immutable so that next test can create new ones
err := dpaCR.Client.Delete(context.Background(), &corev1.Namespace{ObjectMeta: v1.ObjectMeta{
Name: lastBRCase.ApplicationNamespace,
Namespace: lastBRCase.ApplicationNamespace,
}}, &client.DeleteOptions{})
if k8serror.IsNotFound(err) {
err = nil
}
Expect(err).ToNot(HaveOccurred())
err = dpaCR.Delete(runTimeClientForSuiteRun)
Expect(err).ToNot(HaveOccurred())
Eventually(IsNamespaceDeleted(kubernetesClientForSuiteRun, lastBRCase.ApplicationNamespace), timeoutMultiplier*time.Minute*2, time.Second*5).Should(BeTrue())
})
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.