Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions pkg/e2e/e2e.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package e2e
import (
"context"
"encoding/json"
"errors"
"fmt"
"log"
"os"
Expand Down Expand Up @@ -36,6 +37,9 @@ import (
// provisioner is used to deploy and manage clusters.
var provider spi.Provider

// ErrTestsFailed is returned when one or more tests fail.
var ErrTestsFailed = errors.New("tests failed, please inspect logs for more details")

// runLogAnalysis performs log analysis powered failure analysis if enabled
func runLogAnalysis(ctx context.Context, err error) {
log.Println("Running Log analysis")
Expand Down Expand Up @@ -218,7 +222,7 @@ func RunTests(ctx context.Context) int {
exitCode, err = runGinkgoTests()
if err != nil {
log.Printf("OSDE2E failed: %v", err)
if viper.GetBool(config.LogAnalysis.EnableAnalysis) {
if viper.GetBool(config.LogAnalysis.EnableAnalysis) && !errors.Is(err, ErrTestsFailed) {
runLogAnalysis(ctx, err)
}
}
Expand Down Expand Up @@ -350,7 +354,7 @@ func runGinkgoTests() (int, error) {

if !testsPassed || !upgradeTestsPassed {
viper.Set(config.Cluster.Passing, false)
return config.Failure, fmt.Errorf("tests failed, please inspect logs for more details")
return config.Failure, ErrTestsFailed
}

return config.Success, nil
Expand Down