| 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 "flag" | 9 "flag" |
| 10 "fmt" | 10 "fmt" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 testCases := []struct { | 39 testCases := []struct { |
| 40 input string | 40 input string |
| 41 expectations string | 41 expectations string |
| 42 }{ | 42 }{ |
| 43 {"build-exception", "build-exception.json"}, | 43 {"build-exception", "build-exception.json"}, |
| 44 {"build-patch-failure", "build-patch-failure.json"}, | 44 {"build-patch-failure", "build-patch-failure.json"}, |
| 45 {"build-pending", "build-pending.json"}, | 45 {"build-pending", "build-pending.json"}, |
| 46 {"build-running", "build-running.json"}, | 46 {"build-running", "build-running.json"}, |
| 47 {"build-timeout", "build-timeout.json"}, | 47 {"build-timeout", "build-timeout.json"}, |
| 48 {"build-canceled", "build-canceled.json"}, | 48 {"build-canceled", "build-canceled.json"}, |
| 49 {"build-hang", "build-hang.json"}, |
| 49 } | 50 } |
| 50 | 51 |
| 51 c := context.Background() | 52 c := context.Background() |
| 52 c, _ = testclock.UseTime(c, time.Date(2016, time.March, 14, 11, 0, 0, 0,
time.UTC)) | 53 c, _ = testclock.UseTime(c, time.Date(2016, time.March, 14, 11, 0, 0, 0,
time.UTC)) |
| 53 | 54 |
| 54 if *generate { | 55 if *generate { |
| 55 for _, tc := range testCases { | 56 for _, tc := range testCases { |
| 56 fmt.Printf("Generating expectations for %s\n", tc.input) | 57 fmt.Printf("Generating expectations for %s\n", tc.input) |
| 57 build, err := swarmingBuildImpl(c, "foo", "debug", tc.in
put) | 58 build, err := swarmingBuildImpl(c, "foo", "debug", tc.in
put) |
| 58 if err != nil { | 59 if err != nil { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 74 Convey(`A test Environment`, t, func() { | 75 Convey(`A test Environment`, t, func() { |
| 75 for _, tc := range testCases { | 76 for _, tc := range testCases { |
| 76 Convey(fmt.Sprintf("Test Case: %s", tc.input), func() { | 77 Convey(fmt.Sprintf("Test Case: %s", tc.input), func() { |
| 77 build, err := swarmingBuildImpl(c, "foo", "debug
", tc.input) | 78 build, err := swarmingBuildImpl(c, "foo", "debug
", tc.input) |
| 78 So(err, ShouldBeNil) | 79 So(err, ShouldBeNil) |
| 79 So(build, shouldMatchExpectationsFor, tc.expecta
tions) | 80 So(build, shouldMatchExpectationsFor, tc.expecta
tions) |
| 80 }) | 81 }) |
| 81 } | 82 } |
| 82 }) | 83 }) |
| 83 } | 84 } |
| OLD | NEW |