| 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 services | 5 package services |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "errors" | 8 "errors" |
| 9 "testing" | 9 "testing" |
| 10 "time" | 10 "time" |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 | 213 |
| 214 Convey(`Returns internal server error if the Pre
fix Put() fails.`, func() { | 214 Convey(`Returns internal server error if the Pre
fix Put() fails.`, func() { |
| 215 c, fb := featureBreaker.FilterRDS(c, nil
) | 215 c, fb := featureBreaker.FilterRDS(c, nil
) |
| 216 fb.BreakFeatures(errors.New("test error"
), "PutMulti") | 216 fb.BreakFeatures(errors.New("test error"
), "PutMulti") |
| 217 | 217 |
| 218 _, err := svr.RegisterStream(c, &req) | 218 _, err := svr.RegisterStream(c, &req) |
| 219 So(err, ShouldBeRPCInternal) | 219 So(err, ShouldBeRPCInternal) |
| 220 }) | 220 }) |
| 221 | 221 |
| 222 Convey(`Registration failure cases`, func() { | 222 Convey(`Registration failure cases`, func() { |
| 223 Convey(`Will not register a stream if it
s prefix has expired.`, func() { |
| 224 env.Clock.Set(tls.Prefix.Expirat
ion) |
| 225 |
| 226 _, err := svr.RegisterStream(c,
&req) |
| 227 So(err, ShouldBeRPCFailedPrecond
ition, "prefix has expired") |
| 228 }) |
| 229 |
| 223 Convey(`Will not register a stream witho
ut a protobuf version.`, func() { | 230 Convey(`Will not register a stream witho
ut a protobuf version.`, func() { |
| 224 req.ProtoVersion = "" | 231 req.ProtoVersion = "" |
| 225 _, err := svr.RegisterStream(c,
&req) | 232 _, err := svr.RegisterStream(c,
&req) |
| 226 So(err, ShouldBeRPCInvalidArgume
nt, "Unrecognized protobuf version") | 233 So(err, ShouldBeRPCInvalidArgume
nt, "Unrecognized protobuf version") |
| 227 }) | 234 }) |
| 228 | 235 |
| 229 Convey(`Will not register a stream with
an unknown protobuf version.`, func() { | 236 Convey(`Will not register a stream with
an unknown protobuf version.`, func() { |
| 230 req.ProtoVersion = "unknown" | 237 req.ProtoVersion = "unknown" |
| 231 _, err := svr.RegisterStream(c,
&req) | 238 _, err := svr.RegisterStream(c,
&req) |
| 232 So(err, ShouldBeRPCInvalidArgume
nt, "Unrecognized protobuf version") | 239 So(err, ShouldBeRPCInvalidArgume
nt, "Unrecognized protobuf version") |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 fb.BreakFeatures(errors.New("tes
t error"), "PutMulti") | 275 fb.BreakFeatures(errors.New("tes
t error"), "PutMulti") |
| 269 | 276 |
| 270 _, err := rsm.RollForward(c) | 277 _, err := rsm.RollForward(c) |
| 271 So(err, ShouldBeRPCInternal) | 278 So(err, ShouldBeRPCInternal) |
| 272 }) | 279 }) |
| 273 }) | 280 }) |
| 274 }) | 281 }) |
| 275 }) | 282 }) |
| 276 }) | 283 }) |
| 277 } | 284 } |
| OLD | NEW |