mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-10 05:30:26 +00:00
Cleaning up the operations code in client
This commit is contained in:
@@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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": {
|
||||
|
Reference in New Issue
Block a user