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

Side by Side Diff: milo/buildsource/buildbot/buildinfo_test.go

Issue 2974263002: [milo] better ACL system for masters. (Closed)
Patch Set: fix tests Created 3 years, 5 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 "testing" 8 "testing"
9 9
10 miloProto "github.com/luci/luci-go/common/proto/milo" 10 miloProto "github.com/luci/luci-go/common/proto/milo"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 build := buildbotBuild{ 107 build := buildbotBuild{
108 Master: "foo master", 108 Master: "foo master",
109 Buildername: "bar builder", 109 Buildername: "bar builder",
110 Number: 1337, 110 Number: 1337,
111 Properties: []*buildbotProperty{ 111 Properties: []*buildbotProperty{
112 {Name: "foo", Value: "build-foo"}, 112 {Name: "foo", Value: "build-foo"},
113 {Name: "bar", Value: "build-bar"}, 113 {Name: "bar", Value: "build-bar"},
114 }, 114 },
115 } 115 }
116 116
117 // mark foo master as public
118 So(ds.Put(c, &buildbotMasterPublic{"foo master"}), ShouldBeNil)
119
117 logdogStep := miloProto.Step{ 120 logdogStep := miloProto.Step{
118 Command: &miloProto.Step_Command{ 121 Command: &miloProto.Step_Command{
119 CommandLine: []string{"foo", "bar", "baz"}, 122 CommandLine: []string{"foo", "bar", "baz"},
120 }, 123 },
121 Text: []string{"test step"}, 124 Text: []string{"test step"},
122 Property: []*miloProto.Step_Property{ 125 Property: []*miloProto.Step_Property{
123 {Name: "bar", Value: "log-bar"}, 126 {Name: "bar", Value: "log-bar"},
124 }, 127 },
125 } 128 }
126 129
127 biReq := milo.BuildInfoRequest{ 130 biReq := milo.BuildInfoRequest{
128 Build: &milo.BuildInfoRequest_Buildbot{ 131 Build: &milo.BuildInfoRequest_Buildbot{
129 Buildbot: &milo.BuildInfoRequest_BuildBot{ 132 Buildbot: &milo.BuildInfoRequest_BuildBot{
130 MasterName: "foo master", 133 MasterName: "foo master",
131 BuilderName: "bar builder", 134 BuilderName: "bar builder",
132 BuildNumber: 1337, 135 BuildNumber: 1337,
133 }, 136 },
134 }, 137 },
135 } 138 }
136 139
137 Convey("Load an invalid build", func() { 140 Convey("Load an invalid build", func() {
138 _, err := bip.GetBuildInfo(c, 141 _, err := bip.GetBuildInfo(c,
139 &milo.BuildInfoRequest_BuildBot{ 142 &milo.BuildInfoRequest_BuildBot{
140 MasterName: "foo master", 143 MasterName: "foo master",
141 BuilderName: "bar builder", 144 BuilderName: "bar builder",
142 BuildNumber: 1334, 145 BuildNumber: 1334,
143 }, "") 146 }, "")
144 » » » So(err.Error(), ShouldResemble, "rpc error: code = Unaut henticated desc = ") 147 » » » So(err, ShouldErrLike,
148 » » » » "rpc error: code = NotFound desc = Build #1334 f or master \"foo master\", builder \"bar builder\" was not found")
145 }) 149 })
146 150
147 Convey("Can load a BuildBot build by log location.", func() { 151 Convey("Can load a BuildBot build by log location.", func() {
148 build.Properties = append(build.Properties, []*buildbotP roperty{ 152 build.Properties = append(build.Properties, []*buildbotP roperty{
149 {Name: "log_location", Value: "logdog://example. com/testproject/foo/bar/+/baz/annotations"}, 153 {Name: "log_location", Value: "logdog://example. com/testproject/foo/bar/+/baz/annotations"},
150 }...) 154 }...)
151 So(ds.Put(c, &build), ShouldBeNil) 155 So(ds.Put(c, &build), ShouldBeNil)
152 testClient.resp = []interface{}{ 156 testClient.resp = []interface{}{
153 datagramGetResponse("testproject", "foo/bar", &l ogdogStep), 157 datagramGetResponse("testproject", "foo/bar", &l ogdogStep),
154 } 158 }
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 }, 371 },
368 AnnotationStream: &miloProto.LogdogStream{ 372 AnnotationStream: &miloProto.LogdogStream{
369 Server: "example.com", 373 Server: "example.com",
370 Prefix: "bb/foo_master/bar_builder/1337" , 374 Prefix: "bb/foo_master/bar_builder/1337" ,
371 Name: "annotations", 375 Name: "annotations",
372 }, 376 },
373 }) 377 })
374 }) 378 })
375 }) 379 })
376 } 380 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698