| 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 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 c = ct.UseConfig(c, &svcconfig.Coordinator{ | 35 c = ct.UseConfig(c, &svcconfig.Coordinator{ |
| 36 ServiceAuthGroup: "test-services", | 36 ServiceAuthGroup: "test-services", |
| 37 }) | 37 }) |
| 38 fs := authtest.FakeState{} | 38 fs := authtest.FakeState{} |
| 39 c = auth.WithState(c, &fs) | 39 c = auth.WithState(c, &fs) |
| 40 | 40 |
| 41 // Register a test stream. | 41 // Register a test stream. |
| 42 desc := ct.TestLogStreamDescriptor(c, "foo/bar") | 42 desc := ct.TestLogStreamDescriptor(c, "foo/bar") |
| 43 ls := ct.TestLogStream(c, desc) | 43 ls := ct.TestLogStream(c, desc) |
| 44 » » if err := ls.Put(ds.Get(c)); err != nil { | 44 » » if err := ds.Get(c).Put(ls); err != nil { |
| 45 panic(err) | 45 panic(err) |
| 46 } | 46 } |
| 47 | 47 |
| 48 // Prepare a request to load the test stream. | 48 // Prepare a request to load the test stream. |
| 49 req := logdog.LoadStreamRequest{ | 49 req := logdog.LoadStreamRequest{ |
| 50 Path: string(ls.Path()), | 50 Path: string(ls.Path()), |
| 51 } | 51 } |
| 52 | 52 |
| 53 Convey(`Returns Forbidden error if not a service.`, func() { | 53 Convey(`Returns Forbidden error if not a service.`, func() { |
| 54 _, err := be.LoadStream(c, &logdog.LoadStreamRequest{}) | 54 _, err := be.LoadStream(c, &logdog.LoadStreamRequest{}) |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 Convey(`Will return Internal for random datastore failur
es.`, func() { | 107 Convey(`Will return Internal for random datastore failur
es.`, func() { |
| 108 c, fb := featureBreaker.FilterRDS(c, nil) | 108 c, fb := featureBreaker.FilterRDS(c, nil) |
| 109 fb.BreakFeatures(errors.New("test error"), "GetM
ulti") | 109 fb.BreakFeatures(errors.New("test error"), "GetM
ulti") |
| 110 | 110 |
| 111 _, err := be.LoadStream(c, &req) | 111 _, err := be.LoadStream(c, &req) |
| 112 So(err, ShouldBeRPCInternal) | 112 So(err, ShouldBeRPCInternal) |
| 113 }) | 113 }) |
| 114 }) | 114 }) |
| 115 }) | 115 }) |
| 116 } | 116 } |
| OLD | NEW |