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

Side by Side Diff: appengine/cmd/milo/buildbucket/builder_test.go

Issue 2196453002: Milo: Console view prototype (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-go@master
Patch Set: Reviews 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 2016 The LUCI Authors. All rights reserved. 1 // Copyright 2016 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 buildbucket 5 package buildbucket
6 6
7 import ( 7 import (
8 "encoding/json" 8 "encoding/json"
9 "flag" 9 "flag"
10 "fmt" 10 "fmt"
11 "io/ioutil" 11 "io/ioutil"
12 "os" 12 "os"
13 "path/filepath" 13 "path/filepath"
14 "testing" 14 "testing"
15 "time" 15 "time"
16 16
17 "github.com/luci/luci-go/common/clock/testclock" 17 "github.com/luci/luci-go/common/clock/testclock"
18 "golang.org/x/net/context" 18 "golang.org/x/net/context"
19 19
20 . "github.com/smartystreets/goconvey/convey" 20 . "github.com/smartystreets/goconvey/convey"
21 ) 21 )
22 22
23 var generate = flag.Bool("test.generate", false, "Generate expectations instead of running tests.") 23 var generate = flag.Bool("test.generate", false, "Generate expectations instead of running tests.")
24 24
25 func TestBuilder(t *testing.T) { 25 func TestBuilder(t *testing.T) {
26 t.Parallel() 26 t.Parallel()
27 27
28 testCases := []struct{ bucket, builder string }{ 28 testCases := []struct{ bucket, builder string }{
29 {"master.tryserver.infra", "InfraPresubmit"}, 29 {"master.tryserver.infra", "InfraPresubmit"},
30 » » {"master.tryserver.infra", "InfraPresubmit(Swarming)"}, 30 » » {"master.tryserver.infra", "InfraPresubmit.Swarming"},
31 } 31 }
32 32
33 Convey("Builder", t, func() { 33 Convey("Builder", t, func() {
34 c := context.Background() 34 c := context.Background()
35 c, _ = testclock.UseTime(c, time.Date(2016, time.March, 14, 11, 0, 0, 0, time.UTC)) 35 c, _ = testclock.UseTime(c, time.Date(2016, time.March, 14, 11, 0, 0, 0, time.UTC))
36 36
37 for _, tc := range testCases { 37 for _, tc := range testCases {
38 tc := tc 38 tc := tc
39 Convey(fmt.Sprintf("%s:%s", tc.bucket, tc.builder), func () { 39 Convey(fmt.Sprintf("%s:%s", tc.bucket, tc.builder), func () {
40 expectationFilePath := filepath.Join("expectatio ns", tc.bucket, tc.builder+".json") 40 expectationFilePath := filepath.Join("expectatio ns", tc.bucket, tc.builder+".json")
(...skipping 10 matching lines...) Expand all
51 So(err, ShouldBeNil) 51 So(err, ShouldBeNil)
52 } else { 52 } else {
53 expectedJSON, err := ioutil.ReadFile(exp ectationFilePath) 53 expectedJSON, err := ioutil.ReadFile(exp ectationFilePath)
54 So(err, ShouldBeNil) 54 So(err, ShouldBeNil)
55 So(string(actualJSON), ShouldEqual, stri ng(expectedJSON)) 55 So(string(actualJSON), ShouldEqual, stri ng(expectedJSON))
56 } 56 }
57 }) 57 })
58 } 58 }
59 }) 59 })
60 } 60 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698