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

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

Issue 2250263005: Milo: Prefetch logs that are failures (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-go@master
Patch Set: Also add prefetch Created 4 years, 4 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 24 matching lines...) Expand all
35 35
36 } 36 }
37 37
38 func TestBuild(t *testing.T) { 38 func TestBuild(t *testing.T) {
39 c := context.Background() 39 c := context.Background()
40 c, _ = testclock.UseTime(c, time.Date(2016, time.March, 14, 11, 0, 0, 0, time.UTC)) 40 c, _ = testclock.UseTime(c, time.Date(2016, time.March, 14, 11, 0, 0, 0, time.UTC))
41 41
42 if *generate { 42 if *generate {
43 for _, tc := range getTestCases() { 43 for _, tc := range getTestCases() {
44 fmt.Printf("Generating expectations for %s\n", tc) 44 fmt.Printf("Generating expectations for %s\n", tc)
45 » » » build, err := swarmingBuildImpl(c, "foo", "debug", tc) 45 » » » build, _, err := swarmingBuildImpl(c, "foo", "debug", tc )
46 if err != nil { 46 if err != nil {
47 panic(fmt.Errorf("Could not run swarmingBuildImp l for %s: %s", tc, err)) 47 panic(fmt.Errorf("Could not run swarmingBuildImp l for %s: %s", tc, err))
48 } 48 }
49 buildJSON, err := json.MarshalIndent(build, "", " ") 49 buildJSON, err := json.MarshalIndent(build, "", " ")
50 if err != nil { 50 if err != nil {
51 panic(fmt.Errorf("Could not JSON marshal %s: %s" , tc, err)) 51 panic(fmt.Errorf("Could not JSON marshal %s: %s" , tc, err))
52 } 52 }
53 filename := path.Join("expectations", tc+".json") 53 filename := path.Join("expectations", tc+".json")
54 err = ioutil.WriteFile(filename, []byte(buildJSON), 0644 ) 54 err = ioutil.WriteFile(filename, []byte(buildJSON), 0644 )
55 if err != nil { 55 if err != nil {
56 panic(fmt.Errorf("Encountered error while trying to write to %s: %s", filename, err)) 56 panic(fmt.Errorf("Encountered error while trying to write to %s: %s", filename, err))
57 } 57 }
58 } 58 }
59 return 59 return
60 } 60 }
61 61
62 Convey(`A test Environment`, t, func() { 62 Convey(`A test Environment`, t, func() {
63 for _, tc := range getTestCases() { 63 for _, tc := range getTestCases() {
64 Convey(fmt.Sprintf("Test Case: %s", tc), func() { 64 Convey(fmt.Sprintf("Test Case: %s", tc), func() {
65 » » » » build, err := swarmingBuildImpl(c, "foo", "debug ", tc) 65 » » » » build, _, err := swarmingBuildImpl(c, "foo", "de bug", tc)
66 So(err, ShouldBeNil) 66 So(err, ShouldBeNil)
67 So(build, shouldMatchExpectationsFor, tc+".json" ) 67 So(build, shouldMatchExpectationsFor, tc+".json" )
68 }) 68 })
69 } 69 }
70 }) 70 })
71 } 71 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698