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

Unified Diff: milo/appengine/buildbot/builder.go

Issue 2856273004: Milo: Increase test coverage for appengine/buildbot (Closed)
Patch Set: review Created 3 years, 7 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/build_test.go ('k') | milo/appengine/buildbot/builder_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: milo/appengine/buildbot/builder.go
diff --git a/milo/appengine/buildbot/builder.go b/milo/appengine/buildbot/builder.go
index b89682a45e450c66ea6f93037d5009f836b58b4e..ad545d3b19623b818bd4b698f206d40804ca85ee 100644
--- a/milo/appengine/buildbot/builder.go
+++ b/milo/appengine/buildbot/builder.go
@@ -152,6 +152,18 @@ var errMasterNotFound = errors.New(
"Either the request resource was not found or you have insufficient permissions")
var errNotAuth = errors.New("You are not authenticated, try logging in")
+type errBuilderNotFound struct {
+ master string
+ builder string
+ available []string
+}
+
+func (e errBuilderNotFound) Error() string {
+ avail := strings.Join(e.available, "\n")
+ return fmt.Sprintf("Cannot find builder %q in master %q.\nAvailable builders: \n%s",
+ e.builder, e.master, avail)
+}
+
// builderImpl is the implementation for getting a milo builder page from buildbot.
// This gets:
// * Current Builds from querying the master json from the datastore.
@@ -192,10 +204,7 @@ func builderImpl(
keys = append(keys, k)
}
sort.Strings(keys)
- avail := strings.Join(keys, "\n")
- return nil, fmt.Errorf(
- "Cannot find builder %s in master %s.\nAvailable builders: \n%s",
- builderName, masterName, avail)
+ return nil, errBuilderNotFound{masterName, builderName, keys}
}
// Extract pending builds out of the master json.
result.PendingBuilds = make([]*resp.BuildSummary, len(p.PendingBuildStates))
« no previous file with comments | « milo/appengine/buildbot/build_test.go ('k') | milo/appengine/buildbot/builder_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698