| OLD | NEW |
| 1 // Copyright 2015 The LUCI Authors. All rights reserved. | 1 // Copyright 2015 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 coordinator | 5 package coordinator |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "errors" | 8 "errors" |
| 9 "fmt" | 9 "fmt" |
| 10 "testing" | 10 "testing" |
| 11 | 11 |
| 12 "github.com/luci/luci-go/common/clock/testclock" | 12 "github.com/luci/luci-go/common/clock/testclock" |
| 13 "github.com/luci/luci-go/common/config" | |
| 14 "github.com/luci/luci-go/common/proto/google" | 13 "github.com/luci/luci-go/common/proto/google" |
| 15 "github.com/luci/luci-go/common/testing/prpctest" | 14 "github.com/luci/luci-go/common/testing/prpctest" |
| 16 "github.com/luci/luci-go/grpc/grpcutil" | 15 "github.com/luci/luci-go/grpc/grpcutil" |
| 17 "github.com/luci/luci-go/logdog/api/endpoints/coordinator/logs/v1" | 16 "github.com/luci/luci-go/logdog/api/endpoints/coordinator/logs/v1" |
| 18 "github.com/luci/luci-go/logdog/api/logpb" | 17 "github.com/luci/luci-go/logdog/api/logpb" |
| 18 "github.com/luci/luci-go/luci_config/common/cfgtypes" |
| 19 "golang.org/x/net/context" | 19 "golang.org/x/net/context" |
| 20 | 20 |
| 21 . "github.com/smartystreets/goconvey/convey" | 21 . "github.com/smartystreets/goconvey/convey" |
| 22 ) | 22 ) |
| 23 | 23 |
| 24 type testQueryLogsService struct { | 24 type testQueryLogsService struct { |
| 25 testLogsServiceBase | 25 testLogsServiceBase |
| 26 | 26 |
| 27 LR logdog.QueryRequest | 27 LR logdog.QueryRequest |
| 28 H func(*logdog.QueryRequest) (*logdog.QueryResponse, error) | 28 H func(*logdog.QueryRequest) (*logdog.QueryResponse, error) |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 80 |
| 81 prpcClient, err := ts.NewClient() | 81 prpcClient, err := ts.NewClient() |
| 82 if err != nil { | 82 if err != nil { |
| 83 panic(err) | 83 panic(err) |
| 84 } | 84 } |
| 85 client := Client{ | 85 client := Client{ |
| 86 C: logdog.NewLogsPRPCClient(prpcClient), | 86 C: logdog.NewLogsPRPCClient(prpcClient), |
| 87 } | 87 } |
| 88 | 88 |
| 89 Convey(`When making a query request`, func() { | 89 Convey(`When making a query request`, func() { |
| 90 » » » const project = config.ProjectName("myproj") | 90 » » » const project = cfgtypes.ProjectName("myproj") |
| 91 const path = "**/+/**" | 91 const path = "**/+/**" |
| 92 q := QueryOptions{ | 92 q := QueryOptions{ |
| 93 Tags: map[string]string{ | 93 Tags: map[string]string{ |
| 94 "foo": "bar", | 94 "foo": "bar", |
| 95 "baz": "qux", | 95 "baz": "qux", |
| 96 }, | 96 }, |
| 97 ContentType: "application/text", | 97 ContentType: "application/text", |
| 98 Before: now, | 98 Before: now, |
| 99 After: now, | 99 After: now, |
| 100 Purged: Both, | 100 Purged: Both, |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 Convey(`Will return ErrNoAccess if permission denied.`,
func() { | 217 Convey(`Will return ErrNoAccess if permission denied.`,
func() { |
| 218 svc.H = func(*logdog.QueryRequest) (*logdog.Quer
yResponse, error) { | 218 svc.H = func(*logdog.QueryRequest) (*logdog.Quer
yResponse, error) { |
| 219 return nil, grpcutil.Unauthenticated | 219 return nil, grpcutil.Unauthenticated |
| 220 } | 220 } |
| 221 | 221 |
| 222 So(client.Query(c, project, path, q, accumulate)
, ShouldEqual, ErrNoAccess) | 222 So(client.Query(c, project, path, q, accumulate)
, ShouldEqual, ErrNoAccess) |
| 223 }) | 223 }) |
| 224 }) | 224 }) |
| 225 }) | 225 }) |
| 226 } | 226 } |
| OLD | NEW |