| OLD | NEW |
| 1 // Copyright 2015 The LUCI Authors. All rights reserved. | 1 // Copyright 2015 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
| 4 | 4 |
| 5 package swarming | 5 package swarming |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "encoding/json" | 8 "encoding/json" |
| 9 "fmt" | 9 "fmt" |
| 10 "io/ioutil" | 10 "io/ioutil" |
| 11 "os" | 11 "os" |
| 12 "path/filepath" | 12 "path/filepath" |
| 13 "strings" | 13 "strings" |
| 14 "time" | 14 "time" |
| 15 | 15 |
| 16 "golang.org/x/net/context" | 16 "golang.org/x/net/context" |
| 17 | 17 |
| 18 swarming "github.com/luci/luci-go/common/api/swarming/swarming/v1" | 18 swarming "github.com/luci/luci-go/common/api/swarming/swarming/v1" |
| 19 "github.com/luci/luci-go/common/clock/testclock" | 19 "github.com/luci/luci-go/common/clock/testclock" |
| 20 "github.com/luci/luci-go/common/errors" |
| 20 "github.com/luci/luci-go/milo/api/resp" | 21 "github.com/luci/luci-go/milo/api/resp" |
| 21 "github.com/luci/luci-go/milo/appengine/settings" | 22 "github.com/luci/luci-go/milo/appengine/settings" |
| 22 "github.com/luci/luci-go/server/templates" | 23 "github.com/luci/luci-go/server/templates" |
| 23 ) | 24 ) |
| 24 | 25 |
| 25 var testCases = []struct { | 26 var testCases = []struct { |
| 26 input string | 27 input string |
| 27 expectations string | 28 expectations string |
| 28 }{ | 29 }{ |
| 29 {"build-canceled", "build-canceled.json"}, | 30 {"build-canceled", "build-canceled.json"}, |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 func (svc debugSwarmingService) getSwarmingResult(c context.Context, taskID stri
ng) ( | 81 func (svc debugSwarmingService) getSwarmingResult(c context.Context, taskID stri
ng) ( |
| 81 *swarming.SwarmingRpcsTaskResult, error) { | 82 *swarming.SwarmingRpcsTaskResult, error) { |
| 82 | 83 |
| 83 var sr swarming.SwarmingRpcsTaskResult | 84 var sr swarming.SwarmingRpcsTaskResult |
| 84 if err := svc.getSwarmingJSON(taskID, ".swarm", &sr); err != nil { | 85 if err := svc.getSwarmingJSON(taskID, ".swarm", &sr); err != nil { |
| 85 return nil, err | 86 return nil, err |
| 86 } | 87 } |
| 87 return &sr, nil | 88 return &sr, nil |
| 88 } | 89 } |
| 89 | 90 |
| 91 func (svc debugSwarmingService) getSwarmingRequest(c context.Context, taskID str
ing) ( |
| 92 *swarming.SwarmingRpcsTaskRequest, error) { |
| 93 |
| 94 return nil, errors.New("not implemented") |
| 95 } |
| 96 |
| 90 func (svc debugSwarmingService) getTaskOutput(c context.Context, taskID string)
(string, error) { | 97 func (svc debugSwarmingService) getTaskOutput(c context.Context, taskID string)
(string, error) { |
| 91 content, err := svc.getContent(taskID, "") | 98 content, err := svc.getContent(taskID, "") |
| 92 if err != nil { | 99 if err != nil { |
| 93 if os.IsNotExist(err) { | 100 if os.IsNotExist(err) { |
| 94 err = nil | 101 err = nil |
| 95 } | 102 } |
| 96 return "", err | 103 return "", err |
| 97 } | 104 } |
| 98 return string(content), nil | 105 return string(content), nil |
| 99 } | 106 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 if err != nil { | 152 if err != nil { |
| 146 panic(fmt.Errorf("Error while processing %s: %s", tc, er
r)) | 153 panic(fmt.Errorf("Error while processing %s: %s", tc, er
r)) |
| 147 } | 154 } |
| 148 results = append(results, settings.TestBundle{ | 155 results = append(results, settings.TestBundle{ |
| 149 Description: tc, | 156 Description: tc, |
| 150 Data: templates.Args{"Build": build}, | 157 Data: templates.Args{"Build": build}, |
| 151 }) | 158 }) |
| 152 } | 159 } |
| 153 return results | 160 return results |
| 154 } | 161 } |
| OLD | NEW |