diff --git a/test/e2e/functional/e2e_test.go b/test/e2e/functional/e2e_test.go index 5fc6a15fc..e1773f829 100644 --- a/test/e2e/functional/e2e_test.go +++ b/test/e2e/functional/e2e_test.go @@ -10,13 +10,13 @@ import ( "testing" . "github.com/onsi/ginkgo/v2" - "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" + kniK8sReporter "github.com/openshift-kni/k8sreporter" + "github.com/metallb/metallb-operator/test/consts" _ "github.com/metallb/metallb-operator/test/e2e/functional/tests" "github.com/metallb/metallb-operator/test/e2e/k8sreporter" - kniK8sReporter "github.com/openshift-kni/k8sreporter" ) var OperatorNameSpace = consts.DefaultOperatorNameSpace @@ -35,7 +35,13 @@ func init() { } func TestE2E(t *testing.T) { - RegisterFailHandler(Fail) + RegisterFailHandler( + func(message string, callerSkip ...int) { + if r != nil { + k8sreporter.DumpInfo(r, CurrentSpecReport().FullText()) + } + Fail(message, callerSkip...) + }) _, reporterConfig := GinkgoConfiguration() @@ -51,13 +57,3 @@ func TestE2E(t *testing.T) { RunSpecs(t, "Metallb Operator E2E Suite", reporterConfig) } - -var _ = ReportAfterEach(func(specReport types.SpecReport) { - if specReport.Failed() == false { - return - } - - if *reportPath != "" { - k8sreporter.DumpInfo(r, specReport.FullText()) - } -}) diff --git a/test/e2e/validation/validation_test.go b/test/e2e/validation/validation_test.go index 38a4df0e8..1c6b7e8b4 100644 --- a/test/e2e/validation/validation_test.go +++ b/test/e2e/validation/validation_test.go @@ -10,13 +10,13 @@ import ( "testing" . "github.com/onsi/ginkgo/v2" - "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" + kniK8sReporter "github.com/openshift-kni/k8sreporter" + "github.com/metallb/metallb-operator/test/consts" "github.com/metallb/metallb-operator/test/e2e/k8sreporter" _ "github.com/metallb/metallb-operator/test/e2e/validation/tests" - kniK8sReporter "github.com/openshift-kni/k8sreporter" ) var OperatorNameSpace = consts.DefaultOperatorNameSpace @@ -35,7 +35,13 @@ func init() { } func TestValidation(t *testing.T) { - RegisterFailHandler(Fail) + RegisterFailHandler( + func(message string, callerSkip ...int) { + if r != nil { + k8sreporter.DumpInfo(r, CurrentSpecReport().FullText()) + } + Fail(message, callerSkip...) + }) _, reporterConfig := GinkgoConfiguration() @@ -51,13 +57,3 @@ func TestValidation(t *testing.T) { RunSpecs(t, "Metallb Operator Validation Suite", reporterConfig) } - -var _ = ReportAfterEach(func(specReport types.SpecReport) { - if specReport.Failed() == false { - return - } - - if *reportPath != "" { - k8sreporter.DumpInfo(r, specReport.FullText()) - } -})