Skip to content

Commit 408e9ad

Browse files
Increased the Task timeout; better logging of attached files. (#263) (#264)
* Increased the Task timeout; better logging of attached files. * checkpoint --------- Signed-off-by: Jeff Ortel <[email protected]> Signed-off-by: Cherry Picker <[email protected]> Co-authored-by: Jeff Ortel <[email protected]>
1 parent 23f6915 commit 408e9ad

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

analysis/analysis_test.go

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ func TestApplicationAnalysis(t *testing.T) {
147147
if err != nil {
148148
t.Error(err)
149149
}
150-
printAllAtachmentsOnTask(task, dir)
150+
printTaskAttachments(task, dir)
151151
//if this is still running after timeout, then we should move on, this wont work
152152
return
153153

@@ -160,7 +160,7 @@ func TestApplicationAnalysis(t *testing.T) {
160160
if err != nil {
161161
t.Error(err)
162162
}
163-
printAllAtachmentsOnTask(task, dir)
163+
printTaskAttachments(task, dir)
164164
// If the task was unsuccessful there is no reason to continue execution.
165165
return
166166
}
@@ -236,8 +236,8 @@ func TestApplicationAnalysis(t *testing.T) {
236236

237237
} else {
238238
// Ensure stable order of Incidents.
239-
sort.SliceStable(got.Incidents, func(a, b int) bool { return got.Incidents[a].File + fmt.Sprint(got.Incidents[a].Line) < got.Incidents[b].File + fmt.Sprint(got.Incidents[b].Line) })
240-
sort.SliceStable(expected.Incidents, func(a, b int) bool { return expected.Incidents[a].File + fmt.Sprint(expected.Incidents[a].Line) < expected.Incidents[b].File + fmt.Sprint(expected.Incidents[b].Line)})
239+
sort.SliceStable(got.Incidents, func(a, b int) bool { return got.Incidents[a].File+fmt.Sprint(got.Incidents[a].Line) < got.Incidents[b].File+fmt.Sprint(got.Incidents[b].Line) })
240+
sort.SliceStable(expected.Incidents, func(a, b int) bool { return expected.Incidents[a].File+fmt.Sprint(expected.Incidents[a].Line) < expected.Incidents[b].File+fmt.Sprint(expected.Incidents[b].Line) })
241241
for j, gotInc := range got.Incidents {
242242
expectedInc := expected.Incidents[j]
243243
if gotInc.File != expectedInc.File {
@@ -370,17 +370,19 @@ func getDefaultToken() string {
370370
return string(decrypted)
371371
}
372372

373-
func printAllAtachmentsOnTask(task *api.Task, dir string) error {
374-
for _, attachement := range task.Attached {
375-
err := RichClient.File.Get(attachement.ID, dir)
373+
func printTaskAttachments(task *api.Task, dir string) error {
374+
for _, attachment := range task.Attached {
375+
err := RichClient.File.Get(attachment.ID, dir)
376376
if err != nil {
377377
return err
378378
}
379-
b, err := os.ReadFile(filepath.Join(dir, attachement.Name))
379+
b, err := os.ReadFile(filepath.Join(dir, attachment.Name))
380380
if err != nil {
381381
return err
382382
}
383-
pp.Println(string(b))
383+
fmt.Printf("\nAttachment: %s\n", attachment.Name)
384+
fmt.Println(string(b))
385+
fmt.Println("")
384386
}
385387

386388
return nil

analysis/pkg.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ var (
2121
Client *binding.Client
2222
RichClient *binding.RichClient
2323

24-
// Analysis waiting loop 5 minutes (60 * 5s)
25-
Retry = 200
24+
// Analysis waiting loop 20 minutes.
25+
Retry = 240
2626
Wait = 5 * time.Second
2727
)
2828

0 commit comments

Comments
 (0)