From efbdaab43eee265c34b473253eca07d97acfccd5 Mon Sep 17 00:00:00 2001 From: Sergio Cazzolato Date: Wed, 17 Apr 2024 07:52:24 -0300 Subject: [PATCH] Just save output when the state is cancelled or complete This is to avoid saving empty output when the state is waiting. --- spread/testflinger.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spread/testflinger.go b/spread/testflinger.go index 0bc3cf7e..553057a4 100644 --- a/spread/testflinger.go +++ b/spread/testflinger.go @@ -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])