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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « milo/appengine/buildbot/grpc.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: milo/appengine/buildbot/grpc_test.go
diff --git a/milo/appengine/buildbot/grpc_test.go b/milo/appengine/buildbot/grpc_test.go
new file mode 100644
index 0000000000000000000000000000000000000000..e2e6dd52ce0520680c6cc5f5b07007063455fc21
--- /dev/null
+++ b/milo/appengine/buildbot/grpc_test.go
@@ -0,0 +1,70 @@
+// Copyright 2016 The LUCI Authors. All rights reserved.
+// Use of this source code is governed under the Apache License, Version 2.0
+// that can be found in the LICENSE file.
+
+package buildbot
+
+import (
+ "testing"
+
+ "github.com/luci/gae/impl/memory"
+ ds "github.com/luci/gae/service/datastore"
+ "github.com/luci/luci-go/common/clock/testclock"
+ milo "github.com/luci/luci-go/milo/api/proto"
+ . "github.com/smartystreets/goconvey/convey"
+ "golang.org/x/net/context"
+)
+
+func TestGRPC(t *testing.T) {
+ c := memory.Use(context.Background())
+ c, _ = testclock.UseTime(c, testclock.TestTimeUTC)
+
+ Convey(`A test environment`, t, func() {
+ // Add in a public master to satisfy acl.
+ name := "testmaster"
+ bname := "testbuilder"
+ me := &buildbotMasterEntry{Name: name, Internal: false}
+ ds.Put(c, me)
+ ds.GetTestable(c).Consistent(true)
+ ds.GetTestable(c).AutoIndex(true)
+
+ Convey(`Get finished builds`, func() {
+ // Add in some builds.
+ for i := 0; i < 5; i++ {
+ ds.Put(c, &buildbotBuild{
+ Master: name,
+ Buildername: bname,
+ Number: i,
+ Finished: true,
+ })
+ }
+ ds.Put(c, &buildbotBuild{
+ Master: name,
+ Buildername: bname,
+ Number: 6,
+ Finished: false,
+ })
+ ds.GetTestable(c).CatchupIndexes()
+
+ svc := Service{}
+ r := &milo.BuildbotBuildsRequest{
+ Master: name,
+ Builder: bname,
+ }
+ result, err := svc.GetBuildbotBuildsJSON(c, r)
+ So(err, ShouldBeNil)
+ So(len(result.Builds), ShouldEqual, 5)
+
+ Convey(`Also get incomplete builds`, func() {
+ r := &milo.BuildbotBuildsRequest{
+ Master: name,
+ Builder: bname,
+ IncludeCurrent: true,
+ }
+ result, err := svc.GetBuildbotBuildsJSON(c, r)
+ So(err, ShouldBeNil)
+ So(len(result.Builds), ShouldEqual, 6)
+ })
+ })
+ })
+}
« 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