mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-15 06:01:50 +00:00
Propagate rename; tests pass again.
This commit is contained in:
4
pkg/client/cache/reflector.go
vendored
4
pkg/client/cache/reflector.go
vendored
@@ -20,7 +20,7 @@ import (
|
||||
"reflect"
|
||||
"time"
|
||||
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/apitools"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/watch"
|
||||
"github.com/golang/glog"
|
||||
@@ -81,7 +81,7 @@ func (gc *Reflector) watchHandler(w watch.Interface, resourceVersion *uint64) {
|
||||
glog.Errorf("expected type %v, but watch event object had type %v", e, a)
|
||||
continue
|
||||
}
|
||||
jsonBase, err := api.FindJSONBase(event.Object)
|
||||
jsonBase, err := apitools.FindJSONBase(event.Object)
|
||||
if err != nil {
|
||||
glog.Errorf("unable to understand watch event %#v", event)
|
||||
continue
|
||||
|
@@ -27,6 +27,7 @@ import (
|
||||
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||
_ "github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1beta1"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/apitools"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/version"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/watch"
|
||||
@@ -216,7 +217,7 @@ func (c *RESTClient) doRequest(request *http.Request) ([]byte, error) {
|
||||
// Did the server give us a status response?
|
||||
isStatusResponse := false
|
||||
var status api.Status
|
||||
if err := api.DecodeInto(body, &status); err == nil && status.Status != "" {
|
||||
if err := apitools.DecodeInto(body, &status); err == nil && status.Status != "" {
|
||||
isStatusResponse = true
|
||||
}
|
||||
|
||||
|
@@ -26,6 +26,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/apitools"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/version"
|
||||
@@ -308,7 +309,7 @@ func TestCreateController(t *testing.T) {
|
||||
|
||||
func body(obj interface{}, raw *string) *string {
|
||||
if obj != nil {
|
||||
bs, _ := api.Encode(obj)
|
||||
bs, _ := apitools.Encode(obj)
|
||||
body := string(bs)
|
||||
return &body
|
||||
}
|
||||
@@ -470,7 +471,7 @@ func TestDoRequest(t *testing.T) {
|
||||
|
||||
func TestDoRequestAccepted(t *testing.T) {
|
||||
status := api.Status{Status: api.StatusWorking}
|
||||
expectedBody, _ := api.Encode(status)
|
||||
expectedBody, _ := apitools.Encode(status)
|
||||
fakeHandler := util.FakeHandler{
|
||||
StatusCode: 202,
|
||||
ResponseBody: string(expectedBody),
|
||||
@@ -507,7 +508,7 @@ func TestDoRequestAccepted(t *testing.T) {
|
||||
|
||||
func TestDoRequestAcceptedSuccess(t *testing.T) {
|
||||
status := api.Status{Status: api.StatusSuccess}
|
||||
expectedBody, _ := api.Encode(status)
|
||||
expectedBody, _ := apitools.Encode(status)
|
||||
fakeHandler := util.FakeHandler{
|
||||
StatusCode: 202,
|
||||
ResponseBody: string(expectedBody),
|
||||
@@ -527,7 +528,7 @@ func TestDoRequestAcceptedSuccess(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error %#v", err)
|
||||
}
|
||||
statusOut, err := api.Decode(body)
|
||||
statusOut, err := apitools.Decode(body)
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error %#v", err)
|
||||
}
|
||||
|
@@ -28,6 +28,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/apitools"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/tools"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
|
||||
@@ -204,7 +205,7 @@ func (r *Request) Body(obj interface{}) *Request {
|
||||
case io.Reader:
|
||||
r.body = t
|
||||
default:
|
||||
data, err := api.Encode(obj)
|
||||
data, err := apitools.Encode(obj)
|
||||
if err != nil {
|
||||
r.err = err
|
||||
return r
|
||||
@@ -317,7 +318,7 @@ func (r Result) Get() (interface{}, error) {
|
||||
if r.err != nil {
|
||||
return nil, r.err
|
||||
}
|
||||
return api.Decode(r.body)
|
||||
return apitools.Decode(r.body)
|
||||
}
|
||||
|
||||
// Into stores the result into obj, if possible.
|
||||
@@ -325,7 +326,7 @@ func (r Result) Into(obj interface{}) error {
|
||||
if r.err != nil {
|
||||
return r.err
|
||||
}
|
||||
return api.DecodeInto(r.body, obj)
|
||||
return apitools.DecodeInto(r.body, obj)
|
||||
}
|
||||
|
||||
// Error returns the error executing the request, nil if no error occurred.
|
||||
|
@@ -29,6 +29,8 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/common"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/apitools"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/watch"
|
||||
@@ -37,7 +39,7 @@ import (
|
||||
func TestDoRequestNewWay(t *testing.T) {
|
||||
reqBody := "request body"
|
||||
expectedObj := &api.Service{Port: 12345}
|
||||
expectedBody, _ := api.Encode(expectedObj)
|
||||
expectedBody, _ := apitools.Encode(expectedObj)
|
||||
fakeHandler := util.FakeHandler{
|
||||
StatusCode: 200,
|
||||
ResponseBody: string(expectedBody),
|
||||
@@ -70,9 +72,9 @@ func TestDoRequestNewWay(t *testing.T) {
|
||||
|
||||
func TestDoRequestNewWayReader(t *testing.T) {
|
||||
reqObj := &api.Pod{JSONBase: api.JSONBase{ID: "foo"}}
|
||||
reqBodyExpected, _ := api.Encode(reqObj)
|
||||
reqBodyExpected, _ := apitools.Encode(reqObj)
|
||||
expectedObj := &api.Service{Port: 12345}
|
||||
expectedBody, _ := api.Encode(expectedObj)
|
||||
expectedBody, _ := apitools.Encode(expectedObj)
|
||||
fakeHandler := util.FakeHandler{
|
||||
StatusCode: 200,
|
||||
ResponseBody: string(expectedBody),
|
||||
@@ -107,9 +109,9 @@ func TestDoRequestNewWayReader(t *testing.T) {
|
||||
|
||||
func TestDoRequestNewWayObj(t *testing.T) {
|
||||
reqObj := &api.Pod{JSONBase: api.JSONBase{ID: "foo"}}
|
||||
reqBodyExpected, _ := api.Encode(reqObj)
|
||||
reqBodyExpected, _ := apitools.Encode(reqObj)
|
||||
expectedObj := &api.Service{Port: 12345}
|
||||
expectedBody, _ := api.Encode(expectedObj)
|
||||
expectedBody, _ := apitools.Encode(expectedObj)
|
||||
fakeHandler := util.FakeHandler{
|
||||
StatusCode: 200,
|
||||
ResponseBody: string(expectedBody),
|
||||
@@ -143,7 +145,7 @@ func TestDoRequestNewWayObj(t *testing.T) {
|
||||
|
||||
func TestDoRequestNewWayFile(t *testing.T) {
|
||||
reqObj := &api.Pod{JSONBase: api.JSONBase{ID: "foo"}}
|
||||
reqBodyExpected, err := api.Encode(reqObj)
|
||||
reqBodyExpected, err := apitools.Encode(reqObj)
|
||||
if err != nil {
|
||||
t.Errorf("unexpected error: %v", err)
|
||||
}
|
||||
@@ -159,7 +161,7 @@ func TestDoRequestNewWayFile(t *testing.T) {
|
||||
}
|
||||
|
||||
expectedObj := &api.Service{Port: 12345}
|
||||
expectedBody, _ := api.Encode(expectedObj)
|
||||
expectedBody, _ := apitools.Encode(expectedObj)
|
||||
fakeHandler := util.FakeHandler{
|
||||
StatusCode: 200,
|
||||
ResponseBody: string(expectedBody),
|
||||
@@ -294,7 +296,7 @@ func TestPolling(t *testing.T) {
|
||||
|
||||
callNumber := 0
|
||||
testServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
data, err := api.Encode(objects[callNumber])
|
||||
data, err := apitools.Encode(objects[callNumber])
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected encode error")
|
||||
}
|
||||
@@ -400,7 +402,7 @@ func TestWatch(t *testing.T) {
|
||||
|
||||
encoder := json.NewEncoder(w)
|
||||
for _, item := range table {
|
||||
encoder.Encode(&api.WatchEvent{item.t, api.APIObject{item.obj}})
|
||||
encoder.Encode(&api.WatchEvent{item.t, common.Object{item.obj}})
|
||||
flusher.Flush()
|
||||
}
|
||||
}))
|
||||
|
Reference in New Issue
Block a user