| 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 15 matching lines...) Expand all Loading... |
| 26 . "github.com/smartystreets/goconvey/convey" | 26 . "github.com/smartystreets/goconvey/convey" |
| 27 ) | 27 ) |
| 28 | 28 |
| 29 func TestLoadStream(t *testing.T) { | 29 func TestLoadStream(t *testing.T) { |
| 30 t.Parallel() | 30 t.Parallel() |
| 31 | 31 |
| 32 Convey(`With a testing configuration`, t, func() { | 32 Convey(`With a testing configuration`, t, func() { |
| 33 c, tc := testclock.UseTime(context.Background(), testclock.TestT
imeUTC) | 33 c, tc := testclock.UseTime(context.Background(), testclock.TestT
imeUTC) |
| 34 c = memory.Use(c) | 34 c = memory.Use(c) |
| 35 | 35 |
| 36 fs := authtest.FakeState{} |
| 37 c = auth.WithState(c, &fs) |
| 38 |
| 36 svcStub := ct.Services{} | 39 svcStub := ct.Services{} |
| 37 svcStub.InitConfig() | 40 svcStub.InitConfig() |
| 38 svcStub.ServiceConfig.Coordinator.ServiceAuthGroup = "test-servi
ces" | 41 svcStub.ServiceConfig.Coordinator.ServiceAuthGroup = "test-servi
ces" |
| 39 c = coordinator.WithServices(c, &svcStub) | 42 c = coordinator.WithServices(c, &svcStub) |
| 40 | 43 |
| 41 svr := New() | 44 svr := New() |
| 42 | 45 |
| 43 fs := authtest.FakeState{} | |
| 44 c = auth.WithState(c, &fs) | |
| 45 | |
| 46 // Register a test stream. | 46 // Register a test stream. |
| 47 desc := ct.TestLogStreamDescriptor(c, "foo/bar") | 47 desc := ct.TestLogStreamDescriptor(c, "foo/bar") |
| 48 ls := ct.TestLogStream(c, desc) | 48 ls := ct.TestLogStream(c, desc) |
| 49 if err := ds.Get(c).Put(ls); err != nil { | 49 if err := ds.Get(c).Put(ls); err != nil { |
| 50 panic(err) | 50 panic(err) |
| 51 } | 51 } |
| 52 | 52 |
| 53 // Prepare a request to load the test stream. | 53 // Prepare a request to load the test stream. |
| 54 req := logdog.LoadStreamRequest{ | 54 req := logdog.LoadStreamRequest{ |
| 55 Path: string(ls.Path()), | 55 Path: string(ls.Path()), |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 Convey(`Will return Internal for random datastore failur
es.`, func() { | 132 Convey(`Will return Internal for random datastore failur
es.`, func() { |
| 133 c, fb := featureBreaker.FilterRDS(c, nil) | 133 c, fb := featureBreaker.FilterRDS(c, nil) |
| 134 fb.BreakFeatures(errors.New("test error"), "GetM
ulti") | 134 fb.BreakFeatures(errors.New("test error"), "GetM
ulti") |
| 135 | 135 |
| 136 _, err := svr.LoadStream(c, &req) | 136 _, err := svr.LoadStream(c, &req) |
| 137 So(err, ShouldBeRPCInternal) | 137 So(err, ShouldBeRPCInternal) |
| 138 }) | 138 }) |
| 139 }) | 139 }) |
| 140 }) | 140 }) |
| 141 } | 141 } |
| OLD | NEW |