Skip to content

Commit

Permalink
Just save output when the state is cancelled or complete
Browse files Browse the repository at this point in the history
This is to avoid saving empty output when the state is waiting.
  • Loading branch information
sergiocazzolato committed Apr 17, 2024
1 parent cd61616 commit efbdaab
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions spread/testflinger.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,12 @@ func (p *TestFlingerProvider) saveJobOutput(ctx context.Context, s *TestFlingerJ
return fmt.Errorf("Error requesting result output for job: %v", err)
}

state := resRes.JobState
// no output to save if the state is neither completed nor cancelled
if state != CANCELLED && state != COMPLETE && state != COMPLETED {
return nil
}

// Use the last part of the uuid to identify the file
uuidParts := strings.Split(s.d.JobId, "-")
outputFile := fmt.Sprintf(".spread-output.%s.log", uuidParts[len(uuidParts)-1])
Expand Down

0 comments on commit efbdaab

Please sign in to comment.