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

Unified Diff: appengine/tumble/tumbletest.go

Issue 2043423004: Make HTTP middleware easier to use (Closed) Base URL: https://github.com/luci/luci-go@master
Patch Set: Update tests Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: appengine/tumble/tumbletest.go
diff --git a/appengine/tumble/tumbletest.go b/appengine/tumble/tumbletest.go
index 1eee8acc8fcb71c7a0143446c3902648881d55fc..65911f35f80d3d1ccafac41de849fb6d0f35fbdd 100644
--- a/appengine/tumble/tumbletest.go
+++ b/appengine/tumble/tumbletest.go
@@ -21,6 +21,7 @@ import (
"github.com/luci/luci-go/common/cryptorand"
"github.com/luci/luci-go/common/logging"
"github.com/luci/luci-go/common/logging/memlogger"
+ "github.com/luci/luci-go/server/router"
"github.com/luci/luci-go/server/settings"
"golang.org/x/net/context"
)
@@ -117,11 +118,16 @@ func (t *Testing) Iterate(c context.Context) int {
// Process the shard until a success or hard failure.
retryHTTP(c, func(rec *httptest.ResponseRecorder) {
- t.ProcessShardHandler(c, rec, &http.Request{
- Header: http.Header{"X-AppEngine-QueueName": []string{baseName}},
- }, httprouter.Params{
- {Key: "shard_id", Value: toks[4]},
- {Key: "timestamp", Value: toks[6]},
+ t.ProcessShardHandler(&router.Context{
+ Context: c,
+ Writer: rec,
+ Request: &http.Request{
+ Header: http.Header{"X-AppEngine-QueueName": []string{baseName}},
+ },
+ Params: httprouter.Params{
+ {Key: "shard_id", Value: toks[4]},
+ {Key: "timestamp", Value: toks[6]},
+ },
})
})
@@ -137,9 +143,14 @@ func (t *Testing) Iterate(c context.Context) int {
func (t *Testing) FireAllTasks(c context.Context) {
retryHTTP(c, func(rec *httptest.ResponseRecorder) {
// Fire all tasks until a success or hard failure.
- t.FireAllTasksHandler(c, rec, &http.Request{
- Header: http.Header{"X-Appengine-Cron": []string{"true"}},
- }, nil)
+ t.FireAllTasksHandler(&router.Context{
+ Context: c,
+ Writer: rec,
+ Request: &http.Request{
+ Header: http.Header{"X-Appengine-Cron": []string{"true"}},
+ },
+ Params: nil,
iannucci 2016/06/13 19:23:29 can omit nil-initializers for structs.
+ })
})
}

Powered by Google App Engine
This is Rietveld 408576698