| Index: appengine/logdog/coordinator/endpoints/services/loadStream_test.go
|
| diff --git a/appengine/logdog/coordinator/endpoints/services/loadStream_test.go b/appengine/logdog/coordinator/endpoints/services/loadStream_test.go
|
| index fb26aa7598ab3aef557858eca2e78edde376b031..cdec50300800f76b6ede30d587e82f70b10f3dda 100644
|
| --- a/appengine/logdog/coordinator/endpoints/services/loadStream_test.go
|
| +++ b/appengine/logdog/coordinator/endpoints/services/loadStream_test.go
|
| @@ -7,15 +7,17 @@ package services
|
| import (
|
| "errors"
|
| "testing"
|
| + "time"
|
|
|
| "github.com/golang/protobuf/proto"
|
| "github.com/luci/gae/filter/featureBreaker"
|
| "github.com/luci/gae/impl/memory"
|
| ds "github.com/luci/gae/service/datastore"
|
| + "github.com/luci/luci-go/appengine/logdog/coordinator"
|
| ct "github.com/luci/luci-go/appengine/logdog/coordinator/coordinatorTest"
|
| "github.com/luci/luci-go/common/api/logdog_coordinator/services/v1"
|
| "github.com/luci/luci-go/common/clock/testclock"
|
| - "github.com/luci/luci-go/common/proto/logdog/svcconfig"
|
| + "github.com/luci/luci-go/common/proto/google"
|
| "github.com/luci/luci-go/server/auth"
|
| "github.com/luci/luci-go/server/auth/authtest"
|
| "golang.org/x/net/context"
|
| @@ -28,20 +30,23 @@ func TestLoadStream(t *testing.T) {
|
| t.Parallel()
|
|
|
| Convey(`With a testing configuration`, t, func() {
|
| - c, _ := testclock.UseTime(context.Background(), testclock.TestTimeLocal)
|
| - c = memory.Use(context.Background())
|
| - be := Server{}
|
| + c, tc := testclock.UseTime(context.Background(), testclock.TestTimeUTC)
|
| + c = memory.Use(c)
|
| +
|
| + svcStub := ct.Services{}
|
| + svcStub.InitConfig()
|
| + svcStub.ServiceConfig.Coordinator.ServiceAuthGroup = "test-services"
|
| + be := Server{
|
| + ServiceBase: coordinator.ServiceBase{&svcStub},
|
| + }
|
|
|
| - c = ct.UseConfig(c, &svcconfig.Coordinator{
|
| - ServiceAuthGroup: "test-services",
|
| - })
|
| fs := authtest.FakeState{}
|
| c = auth.WithState(c, &fs)
|
|
|
| // Register a test stream.
|
| desc := ct.TestLogStreamDescriptor(c, "foo/bar")
|
| ls := ct.TestLogStream(c, desc)
|
| - if err := ls.Put(ds.Get(c)); err != nil {
|
| + if err := ds.Get(c).Put(ls); err != nil {
|
| panic(err)
|
| }
|
|
|
| @@ -70,6 +75,26 @@ func TestLoadStream(t *testing.T) {
|
| })
|
| })
|
|
|
| + Convey(`Will return archival properties.`, func() {
|
| + tc.Add(1 * time.Hour)
|
| + ls.ArchivalKey = []byte("archival key")
|
| + if err := ds.Get(c).Put(ls); err != nil {
|
| + panic(err)
|
| + }
|
| +
|
| + resp, err := be.LoadStream(c, &req)
|
| + So(err, ShouldBeNil)
|
| + So(resp, ShouldResemble, &logdog.LoadStreamResponse{
|
| + State: &logdog.LogStreamState{
|
| + Path: "testing/+/foo/bar",
|
| + ProtoVersion: "1",
|
| + TerminalIndex: -1,
|
| + },
|
| + ArchivalKey: []byte("archival key"),
|
| + Age: google.NewDuration(1 * time.Hour),
|
| + })
|
| + })
|
| +
|
| Convey(`Will succeed, and return the descriptor when requested.`, func() {
|
| req.Desc = true
|
|
|
|
|