@@ -19,6 +19,7 @@ import (
1919
2020 "github.com/onsi/ginkgo/v2"
2121 "github.com/openshift-eng/openshift-tests-extension/pkg/extension"
22+ "github.com/openshift-eng/openshift-tests-extension/pkg/extension/extensiontests"
2223 configv1 "github.com/openshift/api/config/v1"
2324 "github.com/pkg/errors"
2425 "github.com/sirupsen/logrus"
@@ -289,6 +290,10 @@ func (o *GinkgoRunSuiteOptions) Run(suite *TestSuite, clusterConfig *clusterdisc
289290 return err
290291 }
291292
293+ if len (specs ) == 0 {
294+ return fmt .Errorf ("no tests to run" )
295+ }
296+
292297 tests , err := extensionTestSpecsToOriginTestCases (specs )
293298 if err != nil {
294299 return errors .WithMessage (err , "could not convert test specs to origin test cases" )
@@ -552,7 +557,7 @@ func (o *GinkgoRunSuiteOptions) Run(suite *TestSuite, clusterConfig *clusterdisc
552557 }
553558 }
554559
555- logrus .Warningf ("%d tests failed, %d tests permitted to be retried; %d failures are terminal non-retryable failures " , len (failing ), len (retries ), failedUnretriableTestCount )
560+ logrus .Warningf ("%d tests failed, %d tests permitted to be retried; %d failures are non-retryable" , len (failing ), len (retries ), failedUnretriableTestCount )
556561
557562 // Run the tests in the retries list.
558563 q := newParallelTestQueue (testRunnerContext )
@@ -697,10 +702,26 @@ func (o *GinkgoRunSuiteOptions) Run(suite *TestSuite, clusterConfig *clusterdisc
697702 wasMasterNodeUpdated = clusterinfo .WasMasterNodeUpdated (events )
698703 }
699704
700- // report the outcome of the test
701- if len (failing ) > 0 {
702- names := sets .NewString (testNames (failing )... ).List ()
703- fmt .Fprintf (o .Out , "Failing tests:\n \n %s\n \n " , strings .Join (names , "\n " ))
705+ var blockingFailures , informingFailures []* testCase
706+ for _ , test := range failing {
707+ if isBlockingFailure (test ) {
708+ blockingFailures = append (blockingFailures , test )
709+ } else {
710+ test .testOutputBytes = []byte (fmt .Sprintf ("*** NON-BLOCKING FAILURE: This test failure is not considered terminal because its lifecycle is '%s' and will not prevent the overall suite from passing.\n \n %s" ,
711+ test .extensionTestResult .Lifecycle ,
712+ string (test .testOutputBytes )))
713+ informingFailures = append (informingFailures , test )
714+ }
715+ }
716+
717+ if len (informingFailures ) > 0 {
718+ names := sets .NewString (testNames (informingFailures )... ).List ()
719+ fmt .Fprintf (o .Out , "Informing test failures that don't prevent the overall suite from passing:\n \n \t * %s\n \n " , strings .Join (names , "\n \t * " ))
720+ }
721+
722+ if len (blockingFailures ) > 0 {
723+ names := sets .NewString (testNames (blockingFailures )... ).List ()
724+ fmt .Fprintf (o .Out , "Blocking test failures:\n \n \t * %s\n \n " , strings .Join (names , "\n \t * " ))
704725 }
705726
706727 if len (o .JUnitDir ) > 0 {
@@ -718,24 +739,35 @@ func (o *GinkgoRunSuiteOptions) Run(suite *TestSuite, clusterConfig *clusterdisc
718739 }
719740 }
720741
721- if fail > 0 {
722- if len (failing ) > 0 || suite .MaximumAllowedFlakes == 0 {
723- return fmt .Errorf ("%d fail, %d pass, %d skip (%s)" , fail , pass , skip , duration )
724- }
725- fmt .Fprintf (o .Out , "%d flakes detected, suite allows passing with only flakes\n \n " , fail )
726- }
727-
728- if syntheticFailure {
742+ switch {
743+ case len (blockingFailures ) > 0 :
744+ return fmt .Errorf ("%d blocking fail, %d informing fail, %d pass, %d skip (%s)" , len (blockingFailures ), len (informingFailures ), pass , skip , duration )
745+ case syntheticFailure :
729746 return fmt .Errorf ("failed because an invariant was violated, %d pass, %d skip (%s)\n " , pass , skip , duration )
730- }
731- if monitorTestResultState != monitor .Succeeded {
747+ case monitorTestResultState != monitor .Succeeded :
732748 return fmt .Errorf ("failed due to a MonitorTest failure" )
749+ case len (informingFailures ) > 0 :
750+ fmt .Fprintf (o .Out , "%d informing fail, %d pass, %d skip (%s): suite passes despite failures" , len (informingFailures ), pass , skip , duration )
751+ default :
752+ fmt .Fprintf (o .Out , "%d pass, %d skip (%s)\n " , pass , skip , duration )
733753 }
734754
735- fmt .Fprintf (o .Out , "%d pass, %d skip (%s)\n " , pass , skip , duration )
736755 return ctx .Err ()
737756}
738757
758+ func isBlockingFailure (test * testCase ) bool {
759+ if test .extensionTestResult == nil {
760+ return true
761+ }
762+
763+ switch test .extensionTestResult .Lifecycle {
764+ case extensiontests .LifecycleInforming :
765+ return false
766+ default :
767+ return true
768+ }
769+ }
770+
739771func writeExtensionTestResults (tests []* testCase , dir , filePrefix , fileSuffix string , out io.Writer ) error {
740772 // Ensure the directory exists
741773 err := os .MkdirAll (dir , 0755 )
0 commit comments