| 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" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 func (svc debugSwarmingService) getSwarmingRequest(c context.Context, taskID str
ing) ( | 140 func (svc debugSwarmingService) getSwarmingRequest(c context.Context, taskID str
ing) ( |
| 141 *swarming.SwarmingRpcsTaskRequest, error) { | 141 *swarming.SwarmingRpcsTaskRequest, error) { |
| 142 | 142 |
| 143 return nil, errors.New("not implemented") | 143 return nil, errors.New("not implemented") |
| 144 } | 144 } |
| 145 | 145 |
| 146 func (svc debugSwarmingService) getTaskOutput(c context.Context, taskID string)
(string, error) { | 146 func (svc debugSwarmingService) getTaskOutput(c context.Context, taskID string)
(string, error) { |
| 147 return svc.tc.getSwarmingOutput(), nil | 147 return svc.tc.getSwarmingOutput(), nil |
| 148 } | 148 } |
| 149 | 149 |
| 150 // TestableLog is a subclass of Log that interfaces with TestableHandler and | 150 // LogTestData returns sample test data for log pages. |
| 151 // includes sample test data. | 151 func LogTestData() []settings.TestBundle { |
| 152 type TestableLog struct{ Log } | |
| 153 | |
| 154 // TestableBuild is a subclass of Build that interfaces with TestableHandler and | |
| 155 // includes sample test data. | |
| 156 type TestableBuild struct{ Build } | |
| 157 | |
| 158 // TestData returns sample test data. | |
| 159 func (l TestableLog) TestData() []settings.TestBundle { | |
| 160 return []settings.TestBundle{ | 152 return []settings.TestBundle{ |
| 161 { | 153 { |
| 162 Description: "Basic log", | 154 Description: "Basic log", |
| 163 Data: templates.Args{ | 155 Data: templates.Args{ |
| 164 "Log": "This is the log", | 156 "Log": "This is the log", |
| 165 "Closed": true, | 157 "Closed": true, |
| 166 }, | 158 }, |
| 167 }, | 159 }, |
| 168 } | 160 } |
| 169 } | 161 } |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 Content: &logpb.LogEntry_Datagram{ | 220 Content: &logpb.LogEntry_Datagram{ |
| 229 Datagram: &logpb.Datagram{ | 221 Datagram: &logpb.Datagram{ |
| 230 Data: data, | 222 Data: data, |
| 231 }, | 223 }, |
| 232 }, | 224 }, |
| 233 }, | 225 }, |
| 234 }, | 226 }, |
| 235 } | 227 } |
| 236 } | 228 } |
| 237 | 229 |
| 238 // TestData returns sample test data. | 230 // BuildTestData returns sample test data for swarming build pages. |
| 239 func (b TestableBuild) TestData() []settings.TestBundle { | 231 func BuildTestData() []settings.TestBundle { |
| 240 basic := resp.MiloBuild{ | 232 basic := resp.MiloBuild{ |
| 241 Summary: resp.BuildComponent{ | 233 Summary: resp.BuildComponent{ |
| 242 Label: "Test swarming build", | 234 Label: "Test swarming build", |
| 243 Status: resp.Success, | 235 Status: resp.Success, |
| 244 Started: time.Date(2016, 1, 2, 15, 4, 5, 999999999, tim
e.UTC), | 236 Started: time.Date(2016, 1, 2, 15, 4, 5, 999999999, tim
e.UTC), |
| 245 Finished: time.Date(2016, 1, 2, 15, 4, 6, 999999999, tim
e.UTC), | 237 Finished: time.Date(2016, 1, 2, 15, 4, 6, 999999999, tim
e.UTC), |
| 246 Duration: time.Second, | 238 Duration: time.Second, |
| 247 }, | 239 }, |
| 248 } | 240 } |
| 249 results := []settings.TestBundle{ | 241 results := []settings.TestBundle{ |
| (...skipping 16 matching lines...) Expand all Loading... |
| 266 if err != nil { | 258 if err != nil { |
| 267 panic(fmt.Errorf("Error while processing %s: %s", tc.nam
e, err)) | 259 panic(fmt.Errorf("Error while processing %s: %s", tc.nam
e, err)) |
| 268 } | 260 } |
| 269 results = append(results, settings.TestBundle{ | 261 results = append(results, settings.TestBundle{ |
| 270 Description: tc.name, | 262 Description: tc.name, |
| 271 Data: templates.Args{"Build": build}, | 263 Data: templates.Args{"Build": build}, |
| 272 }) | 264 }) |
| 273 } | 265 } |
| 274 return results | 266 return results |
| 275 } | 267 } |
| OLD | NEW |