refactor testapi and test scripts to prepare for multiple API groups.
This commit is contained in:
@@ -48,7 +48,7 @@ func NewFakeControllerExpectationsLookup(ttl time.Duration) (*ControllerExpectat
|
||||
|
||||
func newReplicationController(replicas int) *api.ReplicationController {
|
||||
rc := &api.ReplicationController{
|
||||
TypeMeta: api.TypeMeta{APIVersion: testapi.Version()},
|
||||
TypeMeta: api.TypeMeta{APIVersion: testapi.Default.Version()},
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
UID: util.NewUUID(),
|
||||
Name: "foobar",
|
||||
@@ -181,14 +181,14 @@ func TestControllerExpectations(t *testing.T) {
|
||||
|
||||
func TestCreateReplica(t *testing.T) {
|
||||
ns := api.NamespaceDefault
|
||||
body := runtime.EncodeOrDie(testapi.Codec(), &api.Pod{ObjectMeta: api.ObjectMeta{Name: "empty_pod"}})
|
||||
body := runtime.EncodeOrDie(testapi.Default.Codec(), &api.Pod{ObjectMeta: api.ObjectMeta{Name: "empty_pod"}})
|
||||
fakeHandler := util.FakeHandler{
|
||||
StatusCode: 200,
|
||||
ResponseBody: string(body),
|
||||
}
|
||||
testServer := httptest.NewServer(&fakeHandler)
|
||||
defer testServer.Close()
|
||||
client := client.NewOrDie(&client.Config{Host: testServer.URL, Version: testapi.Version()})
|
||||
client := client.NewOrDie(&client.Config{Host: testServer.URL, Version: testapi.Default.Version()})
|
||||
|
||||
podControl := RealPodControl{
|
||||
KubeClient: client,
|
||||
@@ -207,7 +207,7 @@ func TestCreateReplica(t *testing.T) {
|
||||
},
|
||||
Spec: controllerSpec.Spec.Template.Spec,
|
||||
}
|
||||
fakeHandler.ValidateRequest(t, testapi.ResourcePath("pods", api.NamespaceDefault, ""), "POST", nil)
|
||||
fakeHandler.ValidateRequest(t, testapi.Default.ResourcePath("pods", api.NamespaceDefault, ""), "POST", nil)
|
||||
actualPod, err := client.Codec.Decode([]byte(fakeHandler.RequestBody))
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error: %#v", err)
|
||||
|
Reference in New Issue
Block a user