Bumping k8s dependencies to 1.13
This commit is contained in:
7
vendor/google.golang.org/appengine/delay/delay.go
generated
vendored
7
vendor/google.golang.org/appengine/delay/delay.go
generated
vendored
@@ -46,6 +46,7 @@ package delay // import "google.golang.org/appengine/delay"
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
stdctx "context"
|
||||
"encoding/gob"
|
||||
"errors"
|
||||
"fmt"
|
||||
@@ -89,8 +90,14 @@ var (
|
||||
|
||||
// context keys
|
||||
headersContextKey contextKey = 0
|
||||
stdContextType = reflect.TypeOf((*stdctx.Context)(nil)).Elem()
|
||||
netContextType = reflect.TypeOf((*context.Context)(nil)).Elem()
|
||||
)
|
||||
|
||||
func isContext(t reflect.Type) bool {
|
||||
return t == stdContextType || t == netContextType
|
||||
}
|
||||
|
||||
// Func declares a new Function. The second argument must be a function with a
|
||||
// first argument of type context.Context.
|
||||
// This function must be called at program initialization time. That means it
|
||||
|
23
vendor/google.golang.org/appengine/delay/delay_go17.go
generated
vendored
23
vendor/google.golang.org/appengine/delay/delay_go17.go
generated
vendored
@@ -1,23 +0,0 @@
|
||||
// Copyright 2017 Google Inc. All rights reserved.
|
||||
// Use of this source code is governed by the Apache 2.0
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//+build go1.7
|
||||
|
||||
package delay
|
||||
|
||||
import (
|
||||
stdctx "context"
|
||||
"reflect"
|
||||
|
||||
netctx "golang.org/x/net/context"
|
||||
)
|
||||
|
||||
var (
|
||||
stdContextType = reflect.TypeOf((*stdctx.Context)(nil)).Elem()
|
||||
netContextType = reflect.TypeOf((*netctx.Context)(nil)).Elem()
|
||||
)
|
||||
|
||||
func isContext(t reflect.Type) bool {
|
||||
return t == stdContextType || t == netContextType
|
||||
}
|
55
vendor/google.golang.org/appengine/delay/delay_go17_test.go
generated
vendored
55
vendor/google.golang.org/appengine/delay/delay_go17_test.go
generated
vendored
@@ -1,55 +0,0 @@
|
||||
// Copyright 2017 Google Inc. All rights reserved.
|
||||
// Use of this source code is governed by the Apache 2.0
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//+build go1.7
|
||||
|
||||
package delay
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
stdctx "context"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
netctx "golang.org/x/net/context"
|
||||
"google.golang.org/appengine/taskqueue"
|
||||
)
|
||||
|
||||
var (
|
||||
stdCtxRuns = 0
|
||||
stdCtxFunc = Func("stdctx", func(c stdctx.Context) {
|
||||
stdCtxRuns++
|
||||
})
|
||||
)
|
||||
|
||||
func TestStandardContext(t *testing.T) {
|
||||
// Fake out the adding of a task.
|
||||
var task *taskqueue.Task
|
||||
taskqueueAdder = func(_ netctx.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)
|
||||
}
|
||||
}
|
19
vendor/google.golang.org/appengine/delay/delay_pre17.go
generated
vendored
19
vendor/google.golang.org/appengine/delay/delay_pre17.go
generated
vendored
@@ -1,19 +0,0 @@
|
||||
// Copyright 2017 Google Inc. All rights reserved.
|
||||
// Use of this source code is governed by the Apache 2.0
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//+build !go1.7
|
||||
|
||||
package delay
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
var contextType = reflect.TypeOf((*context.Context)(nil)).Elem()
|
||||
|
||||
func isContext(t reflect.Type) bool {
|
||||
return t == contextType
|
||||
}
|
36
vendor/google.golang.org/appengine/delay/delay_test.go
generated
vendored
36
vendor/google.golang.org/appengine/delay/delay_test.go
generated
vendored
@@ -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)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user