Call runCleanup() after collecting logs
Current TearDown() calls runCleanup() before collecting logs.
This could miss some logs and event logs will contains the deletion
logs.
This patch changes to call runCleanup() after collecting logs.
@@ -185,10 +185,6 @@ func makeK8sNamespace(baseFuncName string) string {
// TearDown will delete created names using clients.
func TearDown(client *Client) {
- if err := client.runCleanup(); err != nil {
- client.T.Logf("Cleanup error: %+v", err)
- }
-
// Dump the events in the namespace
el, err := client.Kube.CoreV1().Events(client.Namespace).List(context.Background(), metav1.ListOptions{})
if err != nil {
@@ -226,6 +222,10 @@ func TearDown(client *Client) {
}
}
+ if err := client.runCleanup(); err != nil {
+ client.T.Logf("Cleanup error: %+v", err)
+ }
+
client.Tracker.Clean(true)
if err := DeleteNameSpace(client); err != nil {
client.T.Logf("Could not delete the namespace %q: %v", client.Namespace, err)
