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

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

Issue 2856273004: Milo: Increase test coverage for appengine/buildbot (Closed)
Patch Set: Imports, headers Created 3 years, 6 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 2017 The LUCI Authors. All rights reserved. 1 // Copyright 2017 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 buildbot 5 package buildbot
6 6
7 import ( 7 import (
8 "fmt" 8 "fmt"
9 "strconv" 9 "strconv"
10 "strings" 10 "strings"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 // 3) Fetches the LogDog annotation stream and resolves it into a Step. 55 // 3) Fetches the LogDog annotation stream and resolves it into a Step.
56 // 4) Merges some operational BuildBot build information into the Step. 56 // 4) Merges some operational BuildBot build information into the Step.
57 func (p *BuildInfoProvider) GetBuildInfo(c context.Context, req *milo.BuildInfoR equest_BuildBot, 57 func (p *BuildInfoProvider) GetBuildInfo(c context.Context, req *milo.BuildInfoR equest_BuildBot,
58 projectHint cfgtypes.ProjectName) (*milo.BuildInfoResponse, error) { 58 projectHint cfgtypes.ProjectName) (*milo.BuildInfoResponse, error) {
59 59
60 logging.Infof(c, "Loading build info for master %q, builder %q, build #% d", 60 logging.Infof(c, "Loading build info for master %q, builder %q, build #% d",
61 req.MasterName, req.BuilderName, req.BuildNumber) 61 req.MasterName, req.BuilderName, req.BuildNumber)
62 62
63 // Load the BuildBot build from datastore. 63 // Load the BuildBot build from datastore.
64 build, err := getBuild(c, req.MasterName, req.BuilderName, int(req.Build Number)) 64 build, err := getBuild(c, req.MasterName, req.BuilderName, int(req.Build Number))
65 » if err != nil { 65 » switch err {
66 » » if err == errBuildNotFound { 66 » case errBuildNotFound:
67 » » » return nil, grpcutil.Errf(codes.NotFound, "Build #%d for master %q, builder %q was not found", 67 » » return nil, grpcutil.Errf(codes.NotFound, "Build #%d for master %q, builder %q was not found",
68 » » » » req.BuildNumber, req.MasterName, req.BuilderName ) 68 » » » req.BuildNumber, req.MasterName, req.BuilderName)
69 » » } 69 » case errNotAuth:
70 70 » » return nil, grpcutil.Unauthenticated
71 » case nil:
72 » » // continue
73 » default:
71 logging.WithError(err).Errorf(c, "Failed to load build info.") 74 logging.WithError(err).Errorf(c, "Failed to load build info.")
72 return nil, grpcutil.Internal 75 return nil, grpcutil.Internal
76
nodir 2017/05/26 18:33:05 nit: not sure why this blank line is here
Ryan Tseng 2017/05/26 22:49:22 Done.
73 } 77 }
74 78
75 // Create a new LogDog client. 79 // Create a new LogDog client.
76 client, err := p.newLogdogClient(c) 80 client, err := p.newLogdogClient(c)
77 if err != nil { 81 if err != nil {
78 logging.WithError(err).Errorf(c, "Failed to create LogDog client .") 82 logging.WithError(err).Errorf(c, "Failed to create LogDog client .")
79 return nil, grpcutil.Internal 83 return nil, grpcutil.Internal
80 } 84 }
81 85
82 // Identify the LogDog annotation stream from the build. 86 // Identify the LogDog annotation stream from the build.
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 allProps.Add(prop.Name) 265 allProps.Add(prop.Name)
262 266
263 step.Property = append(step.Property, &miloProto.Step_Property{ 267 step.Property = append(step.Property, &miloProto.Step_Property{
264 Name: prop.Name, 268 Name: prop.Name,
265 Value: fmt.Sprintf("%v", prop.Value), 269 Value: fmt.Sprintf("%v", prop.Value),
266 }) 270 })
267 } 271 }
268 272
269 return nil 273 return nil
270 } 274 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698