From 1328b35380d23b8cc1534dfc2fcb112f59ed95c8 Mon Sep 17 00:00:00 2001 From: Rodolfo Napoles Date: Wed, 2 Mar 2022 06:32:52 -0600 Subject: [PATCH] Incorporated feedback to fix unit tests failure and check for err during f.close --- tests/helper/helper_generic.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/helper/helper_generic.go b/tests/helper/helper_generic.go index 07ea0542030..e17c34a1689 100644 --- a/tests/helper/helper_generic.go +++ b/tests/helper/helper_generic.go @@ -343,11 +343,14 @@ func CommonAfterEach(commonVar CommonVar) { if err != nil { fmt.Println("Error: ", err) } else { - defer f.Close() - if _, err = f.WriteString(resultsRow); err != nil { + f.Close() + _, err = f.WriteString(resultsRow) + if err != nil { + fmt.Println("Error: ", err) + } + if err = f.Close(); err != nil { fmt.Println("Error: ", err) } - f.Close() } // delete the random project/namespace created in CommonBeforeEach