@@ -198,8 +198,8 @@ func (o *runCmdOptions) runTest(cmd *cobra.Command, source string, results *v1al
198
198
handleError := func (err error ) {
199
199
handleTestError (runConfig .Config .Namespace .Name , source , results , err )
200
200
}
201
- defer runSteps (runConfig .Post , runConfig .Config .Namespace .Name , runConfig .BaseDir , results , handleError )
202
- if ! runSteps (runConfig .Pre , runConfig .Config .Namespace .Name , runConfig .BaseDir , results , handleError ) {
201
+ defer runSteps (runConfig .Post , runConfig .Config .Namespace .Name , runConfig .BaseDir , source , results , handleError )
202
+ if ! runSteps (runConfig .Pre , runConfig .Config .Namespace .Name , runConfig .BaseDir , source , results , handleError ) {
203
203
return
204
204
}
205
205
@@ -254,8 +254,8 @@ func (o *runCmdOptions) runTestGroup(cmd *cobra.Command, source string, results
254
254
handleError := func (err error ) {
255
255
handleTestError (runConfig .Config .Namespace .Name , source , results , err )
256
256
}
257
- defer runSteps (runConfig .Post , runConfig .Config .Namespace .Name , runConfig .BaseDir , results , handleError )
258
- if ! runSteps (runConfig .Pre , runConfig .Config .Namespace .Name , runConfig .BaseDir , results , handleError ) {
257
+ defer runSteps (runConfig .Post , runConfig .Config .Namespace .Name , runConfig .BaseDir , source , results , handleError )
258
+ if ! runSteps (runConfig .Pre , runConfig .Config .Namespace .Name , runConfig .BaseDir , source , results , handleError ) {
259
259
return
260
260
}
261
261
@@ -352,7 +352,7 @@ func (o *runCmdOptions) createTempNamespace(runConfig *config.RunConfig, cmd *co
352
352
instance , err = v1alpha1 .FindGlobalInstance (o .Context , c )
353
353
354
354
if err != nil && k8serrors .IsForbidden (err ) {
355
- // not allowed to list all instances on the clusterr
355
+ // not allowed to list all instances on the cluster
356
356
return namespace , nil
357
357
} else if err != nil {
358
358
return namespace , err
@@ -548,9 +548,7 @@ func (o *runCmdOptions) createAndRunTest(ctx context.Context, c client.Client, c
548
548
}
549
549
550
550
if runConfig .Config .Dump .Enabled {
551
- if runConfig .Config .Dump .FailedOnly &&
552
- test .Status .Phase != v1alpha1 .TestPhaseFailed && test .Status .Phase != v1alpha1 .TestPhaseError &&
553
- len (test .Status .Errors ) == 0 && ! hasSuiteErrors (& test .Status .Results ) {
551
+ if runConfig .Config .Dump .FailedOnly && ! isFailed (& test ) {
554
552
fmt .Println ("Skip dump for successful test" )
555
553
} else {
556
554
var fileName string
@@ -766,13 +764,13 @@ func (o *runCmdOptions) newSettings(ctx context.Context, runConfig *config.RunCo
766
764
return nil , nil
767
765
}
768
766
769
- func runSteps (steps []config.StepConfig , namespace , baseDir string , results * v1alpha1.TestResults , handleError func (err error )) bool {
767
+ func runSteps (steps []config.StepConfig , namespace , baseDir string , name string , results * v1alpha1.TestResults , handleError func (err error )) bool {
770
768
for idx , step := range steps {
771
769
if len (step .Name ) == 0 {
772
770
step .Name = fmt .Sprintf ("step-%d" , idx )
773
771
}
774
772
775
- if skipStep (step , results ) {
773
+ if skipStep (step , name , results ) {
776
774
fmt .Printf ("Skip %s\n " , step .Name )
777
775
continue
778
776
}
@@ -782,7 +780,7 @@ func runSteps(steps []config.StepConfig, namespace, baseDir string, results *v1a
782
780
if desc == "" {
783
781
desc = fmt .Sprintf ("script %s" , step .Script )
784
782
}
785
- if err := runScript (step .Script , desc , namespace , baseDir , hasErrors ( results ), step .Timeout ); err != nil {
783
+ if err := runScript (step .Script , desc , namespace , baseDir , hasError ( name , results ), step .Timeout ); err != nil {
786
784
handleError (fmt .Errorf (fmt .Sprintf ("Failed to run %s: %v" , desc , err )))
787
785
return false
788
786
}
@@ -824,7 +822,7 @@ func runSteps(steps []config.StepConfig, namespace, baseDir string, results *v1a
824
822
if desc == "" {
825
823
desc = fmt .Sprintf ("inline command %d" , idx )
826
824
}
827
- if err := runScript (file .Name (), desc , namespace , baseDir , hasErrors ( results ), step .Timeout ); err != nil {
825
+ if err := runScript (file .Name (), desc , namespace , baseDir , hasError ( name , results ), step .Timeout ); err != nil {
828
826
handleError (fmt .Errorf (fmt .Sprintf ("Failed to run %s: %v" , desc , err )))
829
827
return false
830
828
}
@@ -834,7 +832,7 @@ func runSteps(steps []config.StepConfig, namespace, baseDir string, results *v1a
834
832
return true
835
833
}
836
834
837
- func skipStep (step config.StepConfig , results * v1alpha1.TestResults ) bool {
835
+ func skipStep (step config.StepConfig , name string , results * v1alpha1.TestResults ) bool {
838
836
if step .If == "" {
839
837
return false
840
838
}
@@ -867,7 +865,7 @@ func skipStep(step config.StepConfig, results *v1alpha1.TestResults) bool {
867
865
case "os" :
868
866
skipStep = (keyValue )[1 ] != r .GOOS
869
867
case "failure()" :
870
- skipStep = ! hasErrors ( results )
868
+ skipStep = ! hasError ( name , results )
871
869
}
872
870
873
871
if skipStep {
0 commit comments