Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(197)

Side by Side Diff: appengine/logdog/coordinator/backend/util_test.go

Issue 1863973002: LogDog: Update to archival V2. (Closed) Base URL: https://github.com/luci/luci-go@grpcutil-errors
Patch Set: Code review comments, use Pub/Sub, archival staging, quality of life. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 backend 5 package backend
6 6
7 import ( 7 import (
8 "net/http" 8 "net/http"
9 "sort"
10 9
11 "github.com/julienschmidt/httprouter" 10 "github.com/julienschmidt/httprouter"
12 tq "github.com/luci/gae/service/taskqueue"
13 "github.com/luci/luci-go/appengine/logdog/coordinator"
14 "github.com/luci/luci-go/common/logdog/types"
15 "github.com/luci/luci-go/server/middleware" 11 "github.com/luci/luci-go/server/middleware"
16 "golang.org/x/net/context" 12 "golang.org/x/net/context"
17
18 . "github.com/smartystreets/goconvey/convey"
19 ) 13 )
20 14
21 // testBase is a middleware.Base which uses its current Context as the base 15 // testBase is a middleware.Base which uses its current Context as the base
22 // context. 16 // context.
23 type testBase struct { 17 type testBase struct {
24 context.Context 18 context.Context
25 } 19 }
26 20
27 func (t *testBase) base(h middleware.Handler) httprouter.Handle { 21 func (t *testBase) base(h middleware.Handler) httprouter.Handle {
28 return func(w http.ResponseWriter, r *http.Request, p httprouter.Params) { 22 return func(w http.ResponseWriter, r *http.Request, p httprouter.Params) {
29 h(t.Context, w, r, p) 23 h(t.Context, w, r, p)
30 } 24 }
31 } 25 }
32
33 func shouldHaveTasks(actual interface{}, expected ...interface{}) string {
34 a := actual.(map[string]*tq.Task)
35 al := make([]string, 0, len(a))
36 for _, t := range a {
37 al = append(al, t.Name)
38 }
39
40 tasks := make([]string, len(expected))
41 for i, t := range expected {
42 tasks[i] = t.(string)
43 }
44
45 sort.Strings(al)
46 sort.Strings(tasks)
47 return ShouldResemble(al, tasks)
48 }
49
50 func archiveTaskName(path string) string {
51 return archiveTaskNameForHash(coordinator.LogStreamFromPath(types.Stream Path(path)).HashID())
52 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698