| 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 "fmt" | 8 "fmt" |
| 9 "io/ioutil" | 9 "io/ioutil" |
| 10 "path/filepath" | 10 "path/filepath" |
| 11 "strings" | 11 "strings" |
| 12 "time" | 12 "time" |
| 13 | 13 |
| 14 "golang.org/x/net/context" | 14 "golang.org/x/net/context" |
| 15 | 15 |
| 16 "github.com/luci/luci-go/common/clock/testclock" | 16 "github.com/luci/luci-go/common/clock/testclock" |
| 17 "github.com/luci/luci-go/milo/api/resp" | 17 "github.com/luci/luci-go/milo/api/resp" |
| 18 "github.com/luci/luci-go/milo/appengine/settings" | 18 "github.com/luci/luci-go/milo/appengine/settings" |
| 19 "github.com/luci/luci-go/server/templates" | 19 "github.com/luci/luci-go/server/templates" |
| 20 ) | 20 ) |
| 21 | 21 |
| 22 var testCases = []struct { | 22 var testCases = []struct { |
| 23 input string | 23 input string |
| 24 expectations string | 24 expectations string |
| 25 }{ | 25 }{ |
| 26 {"build-canceled", "build-canceled.json"}, | 26 {"build-canceled", "build-canceled.json"}, |
| 27 {"build-exception", "build-exception.json"}, | 27 {"build-exception", "build-exception.json"}, |
| 28 » {"build-hang", "build-hang.json"}, | 28 » {"build-expired", "build-expired.json"}, |
| 29 {"build-link", "build-link.json"}, | 29 {"build-link", "build-link.json"}, |
| 30 {"build-patch-failure", "build-patch-failure.json"}, | 30 {"build-patch-failure", "build-patch-failure.json"}, |
| 31 {"build-pending", "build-pending.json"}, | 31 {"build-pending", "build-pending.json"}, |
| 32 {"build-running", "build-running.json"}, | 32 {"build-running", "build-running.json"}, |
| 33 {"build-timeout", "build-timeout.json"}, | 33 {"build-timeout", "build-timeout.json"}, |
| 34 {"build-unicode", "build-unicode.json"}, | 34 {"build-unicode", "build-unicode.json"}, |
| 35 } | 35 } |
| 36 | 36 |
| 37 func getTestCases() []string { | 37 func getTestCases() []string { |
| 38 testdata := filepath.Join("..", "swarming", "testdata") | 38 testdata := filepath.Join("..", "swarming", "testdata") |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 if err != nil { | 94 if err != nil { |
| 95 panic(fmt.Errorf("Error while processing %s: %s", tc, er
r)) | 95 panic(fmt.Errorf("Error while processing %s: %s", tc, er
r)) |
| 96 } | 96 } |
| 97 results = append(results, settings.TestBundle{ | 97 results = append(results, settings.TestBundle{ |
| 98 Description: tc, | 98 Description: tc, |
| 99 Data: templates.Args{"Build": build}, | 99 Data: templates.Args{"Build": build}, |
| 100 }) | 100 }) |
| 101 } | 101 } |
| 102 return results | 102 return results |
| 103 } | 103 } |
| OLD | NEW |