| OLD | NEW |
| 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 coordinator | 5 package coordinator |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "errors" | 8 "errors" |
| 9 "fmt" | 9 "fmt" |
| 10 "testing" | 10 "testing" |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 So(client.Query(c, &q, accumulate), ShouldBeNil) | 152 So(client.Query(c, &q, accumulate), ShouldBeNil) |
| 153 So(results, shouldHaveLogStreams, "test/+/a", "t
est/+/b", "test/+/c") | 153 So(results, shouldHaveLogStreams, "test/+/a", "t
est/+/b", "test/+/c") |
| 154 }) | 154 }) |
| 155 | 155 |
| 156 Convey(`Will properly handle state and protobuf deserial
ization.`, func() { | 156 Convey(`Will properly handle state and protobuf deserial
ization.`, func() { |
| 157 svc.H = func(*logdog.QueryRequest) (*logdog.Quer
yResponse, error) { | 157 svc.H = func(*logdog.QueryRequest) (*logdog.Quer
yResponse, error) { |
| 158 return &logdog.QueryResponse{ | 158 return &logdog.QueryResponse{ |
| 159 Streams: []*logdog.QueryResponse
_Stream{ | 159 Streams: []*logdog.QueryResponse
_Stream{ |
| 160 gen("a", &logdog.LogStre
amState{ | 160 gen("a", &logdog.LogStre
amState{ |
| 161 Created: google.
NewTimestamp(now), | 161 Created: google.
NewTimestamp(now), |
| 162 Updated: google.
NewTimestamp(now), | |
| 163 }), | 162 }), |
| 164 }, | 163 }, |
| 165 }, nil | 164 }, nil |
| 166 } | 165 } |
| 167 | 166 |
| 168 So(client.Query(c, &q, accumulate), ShouldBeNil) | 167 So(client.Query(c, &q, accumulate), ShouldBeNil) |
| 169 So(results, shouldHaveLogStreams, "test/+/a") | 168 So(results, shouldHaveLogStreams, "test/+/a") |
| 170 So(results[0], ShouldResemble, &LogStream{ | 169 So(results[0], ShouldResemble, &LogStream{ |
| 171 Path: "test/+/a", | 170 Path: "test/+/a", |
| 172 Desc: &logpb.LogStreamDescriptor{Prefix:
"test", Name: "a"}, | 171 Desc: &logpb.LogStreamDescriptor{Prefix:
"test", Name: "a"}, |
| 173 State: &StreamState{ | 172 State: &StreamState{ |
| 174 Created: now.UTC(), | 173 Created: now.UTC(), |
| 175 Updated: now.UTC(), | |
| 176 }, | 174 }, |
| 177 }) | 175 }) |
| 178 }) | 176 }) |
| 179 | 177 |
| 180 Convey(`Can query for stream types`, func() { | 178 Convey(`Can query for stream types`, func() { |
| 181 svc.H = func(*logdog.QueryRequest) (*logdog.Quer
yResponse, error) { | 179 svc.H = func(*logdog.QueryRequest) (*logdog.Quer
yResponse, error) { |
| 182 return &logdog.QueryResponse{}, nil | 180 return &logdog.QueryResponse{}, nil |
| 183 } | 181 } |
| 184 | 182 |
| 185 Convey(`Text`, func() { | 183 Convey(`Text`, func() { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 212 Convey(`Will return ErrNoAccess if permission denied.`,
func() { | 210 Convey(`Will return ErrNoAccess if permission denied.`,
func() { |
| 213 svc.H = func(*logdog.QueryRequest) (*logdog.Quer
yResponse, error) { | 211 svc.H = func(*logdog.QueryRequest) (*logdog.Quer
yResponse, error) { |
| 214 return nil, grpcutil.Unauthenticated | 212 return nil, grpcutil.Unauthenticated |
| 215 } | 213 } |
| 216 | 214 |
| 217 So(client.Query(c, &q, accumulate), ShouldEqual,
ErrNoAccess) | 215 So(client.Query(c, &q, accumulate), ShouldEqual,
ErrNoAccess) |
| 218 }) | 216 }) |
| 219 }) | 217 }) |
| 220 }) | 218 }) |
| 221 } | 219 } |
| OLD | NEW |