| 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 logs | 5 package logs |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "fmt" | 8 "fmt" |
| 9 "sort" | 9 "sort" |
| 10 "testing" | 10 "testing" |
| 11 "time" | 11 "time" |
| 12 | 12 |
| 13 "github.com/luci/gae/filter/featureBreaker" | 13 "github.com/luci/gae/filter/featureBreaker" |
| 14 ds "github.com/luci/gae/service/datastore" | 14 ds "github.com/luci/gae/service/datastore" |
| 15 "github.com/luci/luci-go/common/config" | |
| 16 "github.com/luci/luci-go/common/errors" | 15 "github.com/luci/luci-go/common/errors" |
| 17 "github.com/luci/luci-go/common/proto/google" | 16 "github.com/luci/luci-go/common/proto/google" |
| 18 "github.com/luci/luci-go/logdog/api/endpoints/coordinator/logs/v1" | 17 "github.com/luci/luci-go/logdog/api/endpoints/coordinator/logs/v1" |
| 19 "github.com/luci/luci-go/logdog/api/logpb" | 18 "github.com/luci/luci-go/logdog/api/logpb" |
| 20 ct "github.com/luci/luci-go/logdog/appengine/coordinator/coordinatorTest
" | 19 ct "github.com/luci/luci-go/logdog/appengine/coordinator/coordinatorTest
" |
| 21 "github.com/luci/luci-go/logdog/common/types" | 20 "github.com/luci/luci-go/logdog/common/types" |
| 21 "github.com/luci/luci-go/luci_config/common/cfgtypes" |
| 22 | 22 |
| 23 . "github.com/luci/luci-go/common/testing/assertions" | 23 . "github.com/luci/luci-go/common/testing/assertions" |
| 24 . "github.com/smartystreets/goconvey/convey" | 24 . "github.com/smartystreets/goconvey/convey" |
| 25 ) | 25 ) |
| 26 | 26 |
| 27 func shouldHaveLogPaths(actual interface{}, expected ...interface{}) string { | 27 func shouldHaveLogPaths(actual interface{}, expected ...interface{}) string { |
| 28 resp := actual.(*logdog.QueryResponse) | 28 resp := actual.(*logdog.QueryResponse) |
| 29 var paths []string | 29 var paths []string |
| 30 if len(resp.Streams) > 0 { | 30 if len(resp.Streams) > 0 { |
| 31 paths = make([]string, len(resp.Streams)) | 31 paths = make([]string, len(resp.Streams)) |
| (...skipping 27 matching lines...) Expand all Loading... |
| 59 | 59 |
| 60 Convey(`With a testing configuration, a Query request`, t, func() { | 60 Convey(`With a testing configuration, a Query request`, t, func() { |
| 61 c, env := ct.Install() | 61 c, env := ct.Install() |
| 62 c, fb := featureBreaker.FilterRDS(c, nil) | 62 c, fb := featureBreaker.FilterRDS(c, nil) |
| 63 | 63 |
| 64 ds.GetTestable(c).Consistent(true) | 64 ds.GetTestable(c).Consistent(true) |
| 65 | 65 |
| 66 var svrBase server | 66 var svrBase server |
| 67 svr := newService(&svrBase) | 67 svr := newService(&svrBase) |
| 68 | 68 |
| 69 » » const project = config.ProjectName("proj-foo") | 69 » » const project = cfgtypes.ProjectName("proj-foo") |
| 70 | 70 |
| 71 // Stock query request, will be modified by each test. | 71 // Stock query request, will be modified by each test. |
| 72 req := logdog.QueryRequest{ | 72 req := logdog.QueryRequest{ |
| 73 Project: string(project), | 73 Project: string(project), |
| 74 Tags: map[string]string{}, | 74 Tags: map[string]string{}, |
| 75 } | 75 } |
| 76 | 76 |
| 77 // Install a set of stock log streams to query against. | 77 // Install a set of stock log streams to query against. |
| 78 var streamPaths []string | 78 var streamPaths []string |
| 79 var purgedStreamPaths []string | 79 var purgedStreamPaths []string |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 | 470 |
| 471 Convey(`When an invalid tag is specified, returns BadReq
uest error`, func() { | 471 Convey(`When an invalid tag is specified, returns BadReq
uest error`, func() { |
| 472 req.Tags["+++not a valid tag+++"] = "" | 472 req.Tags["+++not a valid tag+++"] = "" |
| 473 | 473 |
| 474 _, err := svr.Query(c, &req) | 474 _, err := svr.Query(c, &req) |
| 475 So(err, ShouldBeRPCInvalidArgument, "invalid tag
constraint") | 475 So(err, ShouldBeRPCInvalidArgument, "invalid tag
constraint") |
| 476 }) | 476 }) |
| 477 }) | 477 }) |
| 478 }) | 478 }) |
| 479 } | 479 } |
| OLD | NEW |