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

Side by Side Diff: milo/appengine/buildbot/grpc_test.go

Issue 2366763002: Milo: Grpc endpoint for multiple builds on a builder (Closed)
Patch Set: Review comments, add smoke test Created 4 years, 2 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
« no previous file with comments | « milo/appengine/buildbot/grpc.go ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file.
4
5 package buildbot
6
7 import (
8 "testing"
9
10 "github.com/luci/gae/impl/memory"
11 ds "github.com/luci/gae/service/datastore"
12 "github.com/luci/luci-go/common/clock/testclock"
13 milo "github.com/luci/luci-go/milo/api/proto"
14 . "github.com/smartystreets/goconvey/convey"
15 "golang.org/x/net/context"
16 )
17
18 func TestGRPC(t *testing.T) {
19 c := memory.Use(context.Background())
20 c, _ = testclock.UseTime(c, testclock.TestTimeUTC)
21
22 Convey(`A test environment`, t, func() {
23 // Add in a public master to satisfy acl.
24 name := "testmaster"
25 bname := "testbuilder"
26 me := &buildbotMasterEntry{Name: name, Internal: false}
27 ds.Put(c, me)
28 ds.GetTestable(c).Consistent(true)
29 ds.GetTestable(c).AutoIndex(true)
30
31 Convey(`Get finished builds`, func() {
32 // Add in some builds.
33 for i := 0; i < 5; i++ {
34 ds.Put(c, &buildbotBuild{
35 Master: name,
36 Buildername: bname,
37 Number: i,
38 Finished: true,
39 })
40 }
41 ds.Put(c, &buildbotBuild{
42 Master: name,
43 Buildername: bname,
44 Number: 6,
45 Finished: false,
46 })
47 ds.GetTestable(c).CatchupIndexes()
48
49 svc := Service{}
50 r := &milo.BuildbotBuildsRequest{
51 Master: name,
52 Builder: bname,
53 }
54 result, err := svc.GetBuildbotBuildsJSON(c, r)
55 So(err, ShouldBeNil)
56 So(len(result.Builds), ShouldEqual, 5)
57
58 Convey(`Also get incomplete builds`, func() {
59 r := &milo.BuildbotBuildsRequest{
60 Master: name,
61 Builder: bname,
62 IncludeCurrent: true,
63 }
64 result, err := svc.GetBuildbotBuildsJSON(c, r)
65 So(err, ShouldBeNil)
66 So(len(result.Builds), ShouldEqual, 6)
67 })
68 })
69 })
70 }
OLDNEW
« no previous file with comments | « milo/appengine/buildbot/grpc.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698