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

Side by Side Diff: appengine/logdog/coordinator/endpoints/logs/get_test.go

Issue 1971493003: LogDog: Project READ access for user endpoints. (Closed) Base URL: https://github.com/luci/luci-go@logdog-project-service-config
Patch Set: Updated patchset dependency Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package logs 5 package logs
6 6
7 import ( 7 import (
8 "bytes" 8 "bytes"
9 "errors" 9 "errors"
10 "fmt" 10 "fmt"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 }) 172 })
173 173
174 Convey(`Will fail with Internal if the datastore Get() d oesn't work.`, func() { 174 Convey(`Will fail with Internal if the datastore Get() d oesn't work.`, func() {
175 c, fb := featureBreaker.FilterRDS(c, nil) 175 c, fb := featureBreaker.FilterRDS(c, nil)
176 fb.BreakFeatures(errors.New("testing error"), "G etMulti") 176 fb.BreakFeatures(errors.New("testing error"), "G etMulti")
177 177
178 _, err := svr.Get(c, &req) 178 _, err := svr.Get(c, &req)
179 So(err, ShouldBeRPCInternal) 179 So(err, ShouldBeRPCInternal)
180 }) 180 })
181 181
182 » » » Convey(`Will fail with NotFound if the log stream does n ot exist (different project).`, func() { 182 » » » Convey(`Will fail with PermissionDenied if the project d oes not exist.`, func() {
183 req.Project = "does-not-exist" 183 req.Project = "does-not-exist"
184 _, err := svr.Get(c, &req) 184 _, err := svr.Get(c, &req)
185 » » » » So(err, ShouldBeRPCNotFound) 185 » » » » So(err, ShouldBeRPCPermissionDenied)
186 » » » })
187
188 » » » Convey(`Will fail with PermissionDenied if the user can' t access the project.`, func() {
189 » » » » req.Project = "proj-exclusive"
190 » » » » _, err := svr.Get(c, &req)
191 » » » » So(err, ShouldBeRPCPermissionDenied)
186 }) 192 })
187 193
188 Convey(`Will fail with NotFound if the log path does not exist (different path).`, func() { 194 Convey(`Will fail with NotFound if the log path does not exist (different path).`, func() {
189 req.Path = "testing/+/does/not/exist" 195 req.Path = "testing/+/does/not/exist"
190 _, err := svr.Get(c, &req) 196 _, err := svr.Get(c, &req)
191 So(err, ShouldBeRPCNotFound) 197 So(err, ShouldBeRPCNotFound)
192 }) 198 })
193 }) 199 })
194 200
195 Convey(`Testing Tail requests (no logs)`, func() { 201 Convey(`Testing Tail requests (no logs)`, func() {
196 req := logdog.TailRequest{ 202 req := logdog.TailRequest{
197 Project: string(project), 203 Project: string(project),
198 Path: string(tls.Path), 204 Path: string(tls.Path),
199 } 205 }
200 206
201 Convey(`Will succeed with no logs.`, func() { 207 Convey(`Will succeed with no logs.`, func() {
202 resp, err := svr.Tail(c, &req) 208 resp, err := svr.Tail(c, &req)
203 209
204 So(err, ShouldBeRPCOK) 210 So(err, ShouldBeRPCOK)
205 So(resp, shouldHaveLogs) 211 So(resp, shouldHaveLogs)
206 }) 212 })
207 213
208 » » » Convey(`Will fail with NotFound if the log stream does n ot exist (different project).`, func() { 214 » » » Convey(`Will fail with PermissionDenied if the project d oes not exist.`, func() {
209 req.Project = "does-not-exist" 215 req.Project = "does-not-exist"
210 _, err := svr.Tail(c, &req) 216 _, err := svr.Tail(c, &req)
211 » » » » So(err, ShouldBeRPCNotFound) 217 » » » » So(err, ShouldBeRPCPermissionDenied)
218 » » » })
219
220 » » » Convey(`Will fail with PermissionDenied if the user can' t access the project.`, func() {
221 » » » » req.Project = "proj-exclusive"
222 » » » » _, err := svr.Tail(c, &req)
223 » » » » So(err, ShouldBeRPCPermissionDenied)
212 }) 224 })
213 225
214 Convey(`Will fail with NotFound if the log path does not exist (different path).`, func() { 226 Convey(`Will fail with NotFound if the log path does not exist (different path).`, func() {
215 req.Path = "testing/+/does/not/exist" 227 req.Path = "testing/+/does/not/exist"
216 _, err := svr.Tail(c, &req) 228 _, err := svr.Tail(c, &req)
217 So(err, ShouldBeRPCNotFound) 229 So(err, ShouldBeRPCNotFound)
218 }) 230 })
219 }) 231 })
220 232
221 Convey(`When testing log data is added`, func() { 233 Convey(`When testing log data is added`, func() {
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 t.Parallel() 547 t.Parallel()
536 548
537 testGetImpl(t, false) 549 testGetImpl(t, false)
538 } 550 }
539 551
540 func TestGetArchived(t *testing.T) { 552 func TestGetArchived(t *testing.T) {
541 t.Parallel() 553 t.Parallel()
542 554
543 testGetImpl(t, false) 555 testGetImpl(t, false)
544 } 556 }
OLDNEW
« no previous file with comments | « appengine/logdog/coordinator/coordinatorTest/context.go ('k') | appengine/logdog/coordinator/endpoints/logs/list.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698