From b89dd7f5c51138d46ff202b4c35b476edac3ac12 Mon Sep 17 00:00:00 2001 From: andyzhangx Date: Sat, 14 Oct 2023 01:18:57 +0000 Subject: [PATCH] test: ignore log print error in test --- test/e2e/suite_test.go | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/test/e2e/suite_test.go b/test/e2e/suite_test.go index 5d5b5d0237..66394d87d5 100644 --- a/test/e2e/suite_test.go +++ b/test/e2e/suite_test.go @@ -67,10 +67,11 @@ var ( ) type testCmd struct { - command string - args []string - startLog string - endLog string + command string + args []string + startLog string + endLog string + ignoreError bool } var _ = ginkgo.BeforeSuite(func(ctx ginkgo.SpecContext) { @@ -190,10 +191,11 @@ var _ = ginkgo.AfterSuite(func(ctx ginkgo.SpecContext) { execTestCmd([]testCmd{createExampleDeployment}) azurefileLog := testCmd{ - command: "bash", - args: []string{"test/utils/azurefile_log.sh"}, - startLog: "===================azurefile log===================", - endLog: "===================================================", + command: "bash", + args: []string{"test/utils/azurefile_log.sh"}, + startLog: "===================azurefile log===================", + endLog: "===================================================", + ignoreError: true, } e2eTeardown := testCmd{ command: "make", @@ -267,7 +269,12 @@ func execTestCmd(cmds []testCmd) { cmdSh.Stdout = os.Stdout cmdSh.Stderr = os.Stderr err = cmdSh.Run() - gomega.Expect(err).NotTo(gomega.HaveOccurred()) + if err != nil { + log.Println(err) + if !cmd.ignoreError { + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + } + } log.Println(cmd.endLog) } }