Skip to content

Commit

Permalink
test: ignore log print error in test
Browse files Browse the repository at this point in the history
  • Loading branch information
andyzhangx committed Oct 14, 2023
1 parent b1fa012 commit b89dd7f
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions test/e2e/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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)
}
}
Expand Down

0 comments on commit b89dd7f

Please sign in to comment.