Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: appengine/cmd/milo/swarming/build_test.go

Issue 2117613002: Milo: Add step text for swarming task exceptions (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-go@master
Patch Set: Tests Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 27 matching lines...) Expand all
38 func TestBuild(t *testing.T) { 38 func TestBuild(t *testing.T) {
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 } 49 }
49 50
50 c := context.Background() 51 c := context.Background()
51 c, _ = testclock.UseTime(c, time.Date(2016, time.March, 14, 11, 0, 0, 0, time.UTC)) 52 c, _ = testclock.UseTime(c, time.Date(2016, time.March, 14, 11, 0, 0, 0, time.UTC))
52 53
53 if *generate { 54 if *generate {
54 for _, tc := range testCases { 55 for _, tc := range testCases {
55 fmt.Printf("Generating expectations for %s\n", tc.input) 56 fmt.Printf("Generating expectations for %s\n", tc.input)
56 build, err := swarmingBuildImpl(c, "foo", "debug", tc.in put) 57 build, err := swarmingBuildImpl(c, "foo", "debug", tc.in put)
57 if err != nil { 58 if err != nil {
(...skipping 15 matching lines...) Expand all
73 Convey(`A test Environment`, t, func() { 74 Convey(`A test Environment`, t, func() {
74 for _, tc := range testCases { 75 for _, tc := range testCases {
75 Convey(fmt.Sprintf("Test Case: %s", tc.input), func() { 76 Convey(fmt.Sprintf("Test Case: %s", tc.input), func() {
76 build, err := swarmingBuildImpl(c, "foo", "debug ", tc.input) 77 build, err := swarmingBuildImpl(c, "foo", "debug ", tc.input)
77 So(err, ShouldBeNil) 78 So(err, ShouldBeNil)
78 So(build, shouldMatchExpectationsFor, tc.expecta tions) 79 So(build, shouldMatchExpectationsFor, tc.expecta tions)
79 }) 80 })
80 } 81 }
81 }) 82 })
82 } 83 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698