Cleaning up the operations code in client

This commit is contained in:
nikhiljindal
2015-01-28 20:41:37 -08:00
parent fcb1cd30ff
commit dc92d3c7a2
13 changed files with 38 additions and 230 deletions

View File

@@ -18,7 +18,6 @@ package controller
import (
"fmt"
"time"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors"
@@ -38,17 +37,15 @@ type PodLister interface {
// REST implements apiserver.RESTStorage for the replication controller service.
type REST struct {
registry Registry
podLister PodLister
pollPeriod time.Duration
registry Registry
podLister PodLister
}
// NewREST returns a new apiserver.RESTStorage for the given registry and PodLister.
func NewREST(registry Registry, podLister PodLister) *REST {
return &REST{
registry: registry,
podLister: podLister,
pollPeriod: time.Second * 10,
registry: registry,
podLister: podLister,
}
}

View File

@@ -243,9 +243,8 @@ func TestCreateController(t *testing.T) {
},
}
storage := REST{
registry: &mockRegistry,
podLister: &mockPodRegistry,
pollPeriod: time.Millisecond * 1,
registry: &mockRegistry,
podLister: &mockPodRegistry,
}
controller := &api.ReplicationController{
ObjectMeta: api.ObjectMeta{Name: "test"},
@@ -278,9 +277,8 @@ func TestCreateController(t *testing.T) {
func TestControllerStorageValidatesCreate(t *testing.T) {
mockRegistry := registrytest.ControllerRegistry{}
storage := REST{
registry: &mockRegistry,
podLister: nil,
pollPeriod: time.Millisecond * 1,
registry: &mockRegistry,
podLister: nil,
}
failureCases := map[string]api.ReplicationController{
"empty ID": {
@@ -309,9 +307,8 @@ func TestControllerStorageValidatesCreate(t *testing.T) {
func TestControllerStorageValidatesUpdate(t *testing.T) {
mockRegistry := registrytest.ControllerRegistry{}
storage := REST{
registry: &mockRegistry,
podLister: nil,
pollPeriod: time.Millisecond * 1,
registry: &mockRegistry,
podLister: nil,
}
failureCases := map[string]api.ReplicationController{
"empty ID": {