Bumping k8s dependencies to 1.13

This commit is contained in:
Cheng Xing
2018-11-16 14:08:25 -08:00
parent 305407125c
commit b4c0b68ec7
8002 changed files with 884099 additions and 276228 deletions

View File

@@ -6,6 +6,7 @@ package delay
import (
"bytes"
stdctx "context"
"encoding/gob"
"errors"
"fmt"
@@ -102,6 +103,11 @@ var (
reqFuncRuns++
reqFuncHeaders, reqFuncErr = RequestHeaders(c)
})
stdCtxRuns = 0
stdCtxFunc = Func("stdctx", func(c stdctx.Context) {
stdCtxRuns++
})
)
type fakeContext struct {
@@ -426,3 +432,33 @@ func TestGetRequestHeadersFromContext(t *testing.T) {
t.Errorf("reqFuncErr: got %v, want nil", reqFuncErr)
}
}
func TestStandardContext(t *testing.T) {
// Fake out the adding of a task.
var task *taskqueue.Task
taskqueueAdder = func(_ context.Context, tk *taskqueue.Task, queue string) (*taskqueue.Task, error) {
if queue != "" {
t.Errorf(`Got queue %q, expected ""`, queue)
}
task = tk
return tk, nil
}
c := newFakeContext()
stdCtxRuns = 0 // reset state
if err := stdCtxFunc.Call(c.ctx); err != nil {
t.Fatal("Function.Call:", err)
}
// Simulate the Task Queue service.
req, err := http.NewRequest("POST", path, bytes.NewBuffer(task.Payload))
if err != nil {
t.Fatalf("Failed making http.Request: %v", err)
}
rw := httptest.NewRecorder()
runFunc(c.ctx, rw, req)
if stdCtxRuns != 1 {
t.Errorf("stdCtxRuns: got %d, want 1", stdCtxRuns)
}
}