Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
5b11b598
Commit
5b11b598
authored
Aug 30, 2016
by
Timothy St. Clair
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes to cleanup storage clients during UT.
During etcd3.clientv3 integration we had discovered we were leaking connections
parent
9f3841b4
Hide whitespace changes
Inline
Side-by-side
Showing
65 changed files
with
309 additions
and
74 deletions
+309
-74
etcd.go
pkg/registry/certificates/etcd/etcd.go
+3
-2
etcd.go
pkg/registry/clusterrole/etcd/etcd.go
+3
-2
etcd.go
pkg/registry/clusterrolebinding/etcd/etcd.go
+3
-2
etcd.go
pkg/registry/configmap/etcd/etcd.go
+3
-2
etcd_test.go
pkg/registry/configmap/etcd/etcd_test.go
+6
-0
etcd.go
pkg/registry/controller/etcd/etcd.go
+3
-2
etcd_test.go
pkg/registry/controller/etcd/etcd_test.go
+9
-0
etcd.go
pkg/registry/daemonset/etcd/etcd.go
+3
-2
etcd_test.go
pkg/registry/daemonset/etcd/etcd_test.go
+6
-0
etcd.go
pkg/registry/deployment/etcd/etcd.go
+3
-2
etcd_test.go
pkg/registry/deployment/etcd/etcd_test.go
+11
-3
etcd.go
pkg/registry/endpoint/etcd/etcd.go
+3
-2
etcd_test.go
pkg/registry/endpoint/etcd/etcd_test.go
+6
-0
etcd.go
pkg/registry/event/etcd/etcd.go
+3
-2
etcd_test.go
pkg/registry/event/etcd/etcd_test.go
+3
-0
store.go
pkg/registry/generic/registry/store.go
+3
-0
store_test.go
pkg/registry/generic/registry/store_test.go
+5
-2
etcd.go
pkg/registry/horizontalpodautoscaler/etcd/etcd.go
+3
-2
etcd_test.go
pkg/registry/horizontalpodautoscaler/etcd/etcd_test.go
+6
-0
etcd.go
pkg/registry/ingress/etcd/etcd.go
+3
-2
etcd_test.go
pkg/registry/ingress/etcd/etcd_test.go
+6
-0
etcd.go
pkg/registry/job/etcd/etcd.go
+3
-2
etcd_test.go
pkg/registry/job/etcd/etcd_test.go
+6
-0
etcd.go
pkg/registry/limitrange/etcd/etcd.go
+3
-2
etcd_test.go
pkg/registry/limitrange/etcd/etcd_test.go
+6
-0
etcd.go
pkg/registry/namespace/etcd/etcd.go
+3
-2
etcd_test.go
pkg/registry/namespace/etcd/etcd_test.go
+8
-0
etcd.go
pkg/registry/networkpolicy/etcd/etcd.go
+3
-2
etcd_test.go
pkg/registry/networkpolicy/etcd/etcd_test.go
+6
-0
etcd.go
pkg/registry/node/etcd/etcd.go
+3
-2
etcd_test.go
pkg/registry/node/etcd/etcd_test.go
+6
-0
etcd.go
pkg/registry/persistentvolume/etcd/etcd.go
+3
-2
etcd_test.go
pkg/registry/persistentvolume/etcd/etcd_test.go
+7
-0
etcd.go
pkg/registry/persistentvolumeclaim/etcd/etcd.go
+3
-2
etcd_test.go
pkg/registry/persistentvolumeclaim/etcd/etcd_test.go
+7
-0
etcd.go
pkg/registry/petset/etcd/etcd.go
+3
-2
etcd_test.go
pkg/registry/petset/etcd/etcd_test.go
+6
-1
etcd.go
pkg/registry/pod/etcd/etcd.go
+3
-2
etcd_test.go
pkg/registry/pod/etcd/etcd_test.go
+18
-0
etcd.go
pkg/registry/poddisruptionbudget/etcd/etcd.go
+3
-2
etcd_test.go
pkg/registry/poddisruptionbudget/etcd/etcd_test.go
+6
-1
etcd.go
pkg/registry/podsecuritypolicy/etcd/etcd.go
+2
-1
etcd_test.go
pkg/registry/podsecuritypolicy/etcd/etcd_test.go
+6
-0
etcd.go
pkg/registry/podtemplate/etcd/etcd.go
+3
-2
etcd_test.go
pkg/registry/podtemplate/etcd/etcd_test.go
+6
-0
etcd.go
pkg/registry/replicaset/etcd/etcd.go
+3
-2
etcd_test.go
pkg/registry/replicaset/etcd/etcd_test.go
+10
-0
etcd.go
pkg/registry/resourcequota/etcd/etcd.go
+3
-2
etcd_test.go
pkg/registry/resourcequota/etcd/etcd_test.go
+7
-0
etcd.go
pkg/registry/role/etcd/etcd.go
+3
-2
etcd.go
pkg/registry/rolebinding/etcd/etcd.go
+3
-2
etcd.go
pkg/registry/scheduledjob/etcd/etcd.go
+3
-2
etcd_test.go
pkg/registry/scheduledjob/etcd/etcd_test.go
+6
-0
etcd.go
pkg/registry/secret/etcd/etcd.go
+3
-2
etcd_test.go
pkg/registry/secret/etcd/etcd_test.go
+6
-0
etcd.go
pkg/registry/service/etcd/etcd.go
+3
-2
etcd_test.go
pkg/registry/service/etcd/etcd_test.go
+6
-0
etcd.go
pkg/registry/serviceaccount/etcd/etcd.go
+3
-2
etcd_test.go
pkg/registry/serviceaccount/etcd/etcd_test.go
+6
-0
etcd.go
pkg/registry/storageclass/etcd/etcd.go
+3
-2
etcd_test.go
pkg/registry/storageclass/etcd/etcd_test.go
+6
-0
etcd.go
pkg/registry/thirdpartyresource/etcd/etcd.go
+3
-2
etcd_test.go
pkg/registry/thirdpartyresource/etcd/etcd_test.go
+6
-0
etcd.go
pkg/registry/thirdpartyresourcedata/etcd/etcd.go
+3
-2
etcd_test.go
pkg/registry/thirdpartyresourcedata/etcd/etcd_test.go
+6
-0
No files found.
pkg/registry/certificates/etcd/etcd.go
View file @
5b11b598
...
@@ -40,7 +40,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST, *ApprovalREST) {
...
@@ -40,7 +40,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST, *ApprovalREST) {
prefix
:=
"/"
+
opts
.
ResourcePrefix
prefix
:=
"/"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
certificates
.
CertificateSigningRequestList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
certificates
.
CertificateSigningRequestList
{}
}
storageInterface
,
_
:=
opts
.
Decorator
(
storageInterface
,
dFunc
:=
opts
.
Decorator
(
opts
.
StorageConfig
,
opts
.
StorageConfig
,
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
CertificateSigningRequests
),
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
CertificateSigningRequests
),
&
certificates
.
CertificateSigningRequest
{},
&
certificates
.
CertificateSigningRequest
{},
...
@@ -72,7 +72,8 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST, *ApprovalREST) {
...
@@ -72,7 +72,8 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST, *ApprovalREST) {
UpdateStrategy
:
csrregistry
.
Strategy
,
UpdateStrategy
:
csrregistry
.
Strategy
,
DeleteStrategy
:
csrregistry
.
Strategy
,
DeleteStrategy
:
csrregistry
.
Strategy
,
Storage
:
storageInterface
,
Storage
:
storageInterface
,
DestroyFunc
:
dFunc
,
}
}
// Subresources use the same store and creation strategy, which only
// Subresources use the same store and creation strategy, which only
...
...
pkg/registry/clusterrole/etcd/etcd.go
View file @
5b11b598
...
@@ -37,7 +37,7 @@ func NewREST(opts generic.RESTOptions) *REST {
...
@@ -37,7 +37,7 @@ func NewREST(opts generic.RESTOptions) *REST {
prefix
:=
"/"
+
opts
.
ResourcePrefix
prefix
:=
"/"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
rbac
.
ClusterRoleList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
rbac
.
ClusterRoleList
{}
}
storageInterface
,
_
:=
opts
.
Decorator
(
storageInterface
,
dFunc
:=
opts
.
Decorator
(
opts
.
StorageConfig
,
opts
.
StorageConfig
,
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
ClusterRoles
),
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
ClusterRoles
),
&
rbac
.
ClusterRole
{},
&
rbac
.
ClusterRole
{},
...
@@ -67,7 +67,8 @@ func NewREST(opts generic.RESTOptions) *REST {
...
@@ -67,7 +67,8 @@ func NewREST(opts generic.RESTOptions) *REST {
UpdateStrategy
:
clusterrole
.
Strategy
,
UpdateStrategy
:
clusterrole
.
Strategy
,
DeleteStrategy
:
clusterrole
.
Strategy
,
DeleteStrategy
:
clusterrole
.
Strategy
,
Storage
:
storageInterface
,
Storage
:
storageInterface
,
DestroyFunc
:
dFunc
,
}
}
return
&
REST
{
store
}
return
&
REST
{
store
}
...
...
pkg/registry/clusterrolebinding/etcd/etcd.go
View file @
5b11b598
...
@@ -37,7 +37,7 @@ func NewREST(opts generic.RESTOptions) *REST {
...
@@ -37,7 +37,7 @@ func NewREST(opts generic.RESTOptions) *REST {
prefix
:=
"/"
+
opts
.
ResourcePrefix
prefix
:=
"/"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
rbac
.
ClusterRoleBindingList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
rbac
.
ClusterRoleBindingList
{}
}
storageInterface
,
_
:=
opts
.
Decorator
(
storageInterface
,
dFunc
:=
opts
.
Decorator
(
opts
.
StorageConfig
,
opts
.
StorageConfig
,
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
ClusterRoleBindings
),
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
ClusterRoleBindings
),
&
rbac
.
ClusterRoleBinding
{},
&
rbac
.
ClusterRoleBinding
{},
...
@@ -67,7 +67,8 @@ func NewREST(opts generic.RESTOptions) *REST {
...
@@ -67,7 +67,8 @@ func NewREST(opts generic.RESTOptions) *REST {
UpdateStrategy
:
clusterrolebinding
.
Strategy
,
UpdateStrategy
:
clusterrolebinding
.
Strategy
,
DeleteStrategy
:
clusterrolebinding
.
Strategy
,
DeleteStrategy
:
clusterrolebinding
.
Strategy
,
Storage
:
storageInterface
,
Storage
:
storageInterface
,
DestroyFunc
:
dFunc
,
}
}
return
&
REST
{
store
}
return
&
REST
{
store
}
...
...
pkg/registry/configmap/etcd/etcd.go
View file @
5b11b598
...
@@ -36,7 +36,7 @@ func NewREST(opts generic.RESTOptions) *REST {
...
@@ -36,7 +36,7 @@ func NewREST(opts generic.RESTOptions) *REST {
prefix
:=
"/"
+
opts
.
ResourcePrefix
prefix
:=
"/"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
ConfigMapList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
ConfigMapList
{}
}
storageInterface
,
_
:=
opts
.
Decorator
(
storageInterface
,
dFunc
:=
opts
.
Decorator
(
opts
.
StorageConfig
,
opts
.
StorageConfig
,
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
ConfigMaps
),
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
ConfigMaps
),
&
api
.
ConfigMap
{},
&
api
.
ConfigMap
{},
...
@@ -81,7 +81,8 @@ func NewREST(opts generic.RESTOptions) *REST {
...
@@ -81,7 +81,8 @@ func NewREST(opts generic.RESTOptions) *REST {
UpdateStrategy
:
configmap
.
Strategy
,
UpdateStrategy
:
configmap
.
Strategy
,
DeleteStrategy
:
configmap
.
Strategy
,
DeleteStrategy
:
configmap
.
Strategy
,
Storage
:
storageInterface
,
Storage
:
storageInterface
,
DestroyFunc
:
dFunc
,
}
}
return
&
REST
{
store
}
return
&
REST
{
store
}
}
}
pkg/registry/configmap/etcd/etcd_test.go
View file @
5b11b598
...
@@ -53,6 +53,7 @@ func validNewConfigMap() *api.ConfigMap {
...
@@ -53,6 +53,7 @@ func validNewConfigMap() *api.ConfigMap {
func
TestCreate
(
t
*
testing
.
T
)
{
func
TestCreate
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
validConfigMap
:=
validNewConfigMap
()
validConfigMap
:=
validNewConfigMap
()
...
@@ -80,6 +81,7 @@ func TestCreate(t *testing.T) {
...
@@ -80,6 +81,7 @@ func TestCreate(t *testing.T) {
func
TestUpdate
(
t
*
testing
.
T
)
{
func
TestUpdate
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestUpdate
(
test
.
TestUpdate
(
// valid
// valid
...
@@ -102,6 +104,7 @@ func TestUpdate(t *testing.T) {
...
@@ -102,6 +104,7 @@ func TestUpdate(t *testing.T) {
func
TestDelete
(
t
*
testing
.
T
)
{
func
TestDelete
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestDelete
(
validNewConfigMap
())
test
.
TestDelete
(
validNewConfigMap
())
}
}
...
@@ -109,6 +112,7 @@ func TestDelete(t *testing.T) {
...
@@ -109,6 +112,7 @@ func TestDelete(t *testing.T) {
func
TestGet
(
t
*
testing
.
T
)
{
func
TestGet
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestGet
(
validNewConfigMap
())
test
.
TestGet
(
validNewConfigMap
())
}
}
...
@@ -116,6 +120,7 @@ func TestGet(t *testing.T) {
...
@@ -116,6 +120,7 @@ func TestGet(t *testing.T) {
func
TestList
(
t
*
testing
.
T
)
{
func
TestList
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestList
(
validNewConfigMap
())
test
.
TestList
(
validNewConfigMap
())
}
}
...
@@ -123,6 +128,7 @@ func TestList(t *testing.T) {
...
@@ -123,6 +128,7 @@ func TestList(t *testing.T) {
func
TestWatch
(
t
*
testing
.
T
)
{
func
TestWatch
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestWatch
(
test
.
TestWatch
(
validNewConfigMap
(),
validNewConfigMap
(),
...
...
pkg/registry/controller/etcd/etcd.go
View file @
5b11b598
...
@@ -62,7 +62,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
...
@@ -62,7 +62,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
prefix
:=
"/"
+
opts
.
ResourcePrefix
prefix
:=
"/"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
ReplicationControllerList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
ReplicationControllerList
{}
}
storageInterface
,
_
:=
opts
.
Decorator
(
storageInterface
,
dFunc
:=
opts
.
Decorator
(
opts
.
StorageConfig
,
opts
.
StorageConfig
,
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
Controllers
),
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
Controllers
),
&
api
.
ReplicationController
{},
&
api
.
ReplicationController
{},
...
@@ -104,7 +104,8 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
...
@@ -104,7 +104,8 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
UpdateStrategy
:
controller
.
Strategy
,
UpdateStrategy
:
controller
.
Strategy
,
DeleteStrategy
:
controller
.
Strategy
,
DeleteStrategy
:
controller
.
Strategy
,
Storage
:
storageInterface
,
Storage
:
storageInterface
,
DestroyFunc
:
dFunc
,
}
}
statusStore
:=
*
store
statusStore
:=
*
store
statusStore
.
UpdateStrategy
=
controller
.
StatusStrategy
statusStore
.
UpdateStrategy
=
controller
.
StatusStrategy
...
...
pkg/registry/controller/etcd/etcd_test.go
View file @
5b11b598
...
@@ -88,6 +88,7 @@ var validController = validNewController()
...
@@ -88,6 +88,7 @@ var validController = validNewController()
func
TestCreate
(
t
*
testing
.
T
)
{
func
TestCreate
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Controller
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Controller
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Controller
.
Store
)
controller
:=
validNewController
()
controller
:=
validNewController
()
controller
.
ObjectMeta
=
api
.
ObjectMeta
{}
controller
.
ObjectMeta
=
api
.
ObjectMeta
{}
...
@@ -108,6 +109,7 @@ func TestCreate(t *testing.T) {
...
@@ -108,6 +109,7 @@ func TestCreate(t *testing.T) {
func
TestUpdate
(
t
*
testing
.
T
)
{
func
TestUpdate
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Controller
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Controller
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Controller
.
Store
)
test
.
TestUpdate
(
test
.
TestUpdate
(
// valid
// valid
...
@@ -135,6 +137,7 @@ func TestUpdate(t *testing.T) {
...
@@ -135,6 +137,7 @@ func TestUpdate(t *testing.T) {
func
TestDelete
(
t
*
testing
.
T
)
{
func
TestDelete
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Controller
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Controller
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Controller
.
Store
)
test
.
TestDelete
(
validNewController
())
test
.
TestDelete
(
validNewController
())
}
}
...
@@ -142,6 +145,7 @@ func TestDelete(t *testing.T) {
...
@@ -142,6 +145,7 @@ func TestDelete(t *testing.T) {
func
TestGenerationNumber
(
t
*
testing
.
T
)
{
func
TestGenerationNumber
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Controller
.
Store
.
DestroyFunc
()
modifiedSno
:=
*
validNewController
()
modifiedSno
:=
*
validNewController
()
modifiedSno
.
Generation
=
100
modifiedSno
.
Generation
=
100
modifiedSno
.
Status
.
ObservedGeneration
=
10
modifiedSno
.
Status
.
ObservedGeneration
=
10
...
@@ -192,6 +196,7 @@ func TestGenerationNumber(t *testing.T) {
...
@@ -192,6 +196,7 @@ func TestGenerationNumber(t *testing.T) {
func
TestGet
(
t
*
testing
.
T
)
{
func
TestGet
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Controller
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Controller
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Controller
.
Store
)
test
.
TestGet
(
validNewController
())
test
.
TestGet
(
validNewController
())
}
}
...
@@ -199,6 +204,7 @@ func TestGet(t *testing.T) {
...
@@ -199,6 +204,7 @@ func TestGet(t *testing.T) {
func
TestList
(
t
*
testing
.
T
)
{
func
TestList
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Controller
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Controller
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Controller
.
Store
)
test
.
TestList
(
validNewController
())
test
.
TestList
(
validNewController
())
}
}
...
@@ -206,6 +212,7 @@ func TestList(t *testing.T) {
...
@@ -206,6 +212,7 @@ func TestList(t *testing.T) {
func
TestWatch
(
t
*
testing
.
T
)
{
func
TestWatch
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Controller
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Controller
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Controller
.
Store
)
test
.
TestWatch
(
test
.
TestWatch
(
validController
,
validController
,
...
@@ -240,6 +247,7 @@ func TestWatch(t *testing.T) {
...
@@ -240,6 +247,7 @@ func TestWatch(t *testing.T) {
func
TestScaleGet
(
t
*
testing
.
T
)
{
func
TestScaleGet
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Controller
.
Store
.
DestroyFunc
()
ctx
:=
api
.
WithNamespace
(
api
.
NewContext
(),
namespace
)
ctx
:=
api
.
WithNamespace
(
api
.
NewContext
(),
namespace
)
rc
,
err
:=
createController
(
storage
.
Controller
,
*
validController
,
t
)
rc
,
err
:=
createController
(
storage
.
Controller
,
*
validController
,
t
)
...
@@ -276,6 +284,7 @@ func TestScaleGet(t *testing.T) {
...
@@ -276,6 +284,7 @@ func TestScaleGet(t *testing.T) {
func
TestScaleUpdate
(
t
*
testing
.
T
)
{
func
TestScaleUpdate
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Controller
.
Store
.
DestroyFunc
()
ctx
:=
api
.
WithNamespace
(
api
.
NewContext
(),
namespace
)
ctx
:=
api
.
WithNamespace
(
api
.
NewContext
(),
namespace
)
rc
,
err
:=
createController
(
storage
.
Controller
,
*
validController
,
t
)
rc
,
err
:=
createController
(
storage
.
Controller
,
*
validController
,
t
)
...
...
pkg/registry/daemonset/etcd/etcd.go
View file @
5b11b598
...
@@ -38,7 +38,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
...
@@ -38,7 +38,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
prefix
:=
"/"
+
opts
.
ResourcePrefix
prefix
:=
"/"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
extensions
.
DaemonSetList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
extensions
.
DaemonSetList
{}
}
storageInterface
,
_
:=
opts
.
Decorator
(
storageInterface
,
dFunc
:=
opts
.
Decorator
(
opts
.
StorageConfig
,
opts
.
StorageConfig
,
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
Daemonsets
),
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
Daemonsets
),
&
extensions
.
DaemonSet
{},
&
extensions
.
DaemonSet
{},
...
@@ -79,7 +79,8 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
...
@@ -79,7 +79,8 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
UpdateStrategy
:
daemonset
.
Strategy
,
UpdateStrategy
:
daemonset
.
Strategy
,
DeleteStrategy
:
daemonset
.
Strategy
,
DeleteStrategy
:
daemonset
.
Strategy
,
Storage
:
storageInterface
,
Storage
:
storageInterface
,
DestroyFunc
:
dFunc
,
}
}
statusStore
:=
*
store
statusStore
:=
*
store
statusStore
.
UpdateStrategy
=
daemonset
.
StatusStrategy
statusStore
.
UpdateStrategy
=
daemonset
.
StatusStrategy
...
...
pkg/registry/daemonset/etcd/etcd_test.go
View file @
5b11b598
...
@@ -70,6 +70,7 @@ var validDaemonSet = newValidDaemonSet()
...
@@ -70,6 +70,7 @@ var validDaemonSet = newValidDaemonSet()
func
TestCreate
(
t
*
testing
.
T
)
{
func
TestCreate
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
ds
:=
newValidDaemonSet
()
ds
:=
newValidDaemonSet
()
ds
.
ObjectMeta
=
api
.
ObjectMeta
{}
ds
.
ObjectMeta
=
api
.
ObjectMeta
{}
...
@@ -96,6 +97,7 @@ func TestCreate(t *testing.T) {
...
@@ -96,6 +97,7 @@ func TestCreate(t *testing.T) {
func
TestUpdate
(
t
*
testing
.
T
)
{
func
TestUpdate
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestUpdate
(
test
.
TestUpdate
(
// valid
// valid
...
@@ -124,6 +126,7 @@ func TestUpdate(t *testing.T) {
...
@@ -124,6 +126,7 @@ func TestUpdate(t *testing.T) {
func
TestDelete
(
t
*
testing
.
T
)
{
func
TestDelete
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestDelete
(
newValidDaemonSet
())
test
.
TestDelete
(
newValidDaemonSet
())
}
}
...
@@ -131,6 +134,7 @@ func TestDelete(t *testing.T) {
...
@@ -131,6 +134,7 @@ func TestDelete(t *testing.T) {
func
TestGet
(
t
*
testing
.
T
)
{
func
TestGet
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestGet
(
newValidDaemonSet
())
test
.
TestGet
(
newValidDaemonSet
())
}
}
...
@@ -138,6 +142,7 @@ func TestGet(t *testing.T) {
...
@@ -138,6 +142,7 @@ func TestGet(t *testing.T) {
func
TestList
(
t
*
testing
.
T
)
{
func
TestList
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestList
(
newValidDaemonSet
())
test
.
TestList
(
newValidDaemonSet
())
}
}
...
@@ -145,6 +150,7 @@ func TestList(t *testing.T) {
...
@@ -145,6 +150,7 @@ func TestList(t *testing.T) {
func
TestWatch
(
t
*
testing
.
T
)
{
func
TestWatch
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestWatch
(
test
.
TestWatch
(
validDaemonSet
,
validDaemonSet
,
...
...
pkg/registry/deployment/etcd/etcd.go
View file @
5b11b598
...
@@ -62,7 +62,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST, *RollbackREST) {
...
@@ -62,7 +62,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST, *RollbackREST) {
prefix
:=
"/"
+
opts
.
ResourcePrefix
prefix
:=
"/"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
extensions
.
DeploymentList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
extensions
.
DeploymentList
{}
}
storageInterface
,
_
:=
opts
.
Decorator
(
storageInterface
,
dFunc
:=
opts
.
Decorator
(
opts
.
StorageConfig
,
opts
.
StorageConfig
,
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
Deployments
),
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
Deployments
),
&
extensions
.
Deployment
{},
&
extensions
.
Deployment
{},
...
@@ -102,7 +102,8 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST, *RollbackREST) {
...
@@ -102,7 +102,8 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST, *RollbackREST) {
UpdateStrategy
:
deployment
.
Strategy
,
UpdateStrategy
:
deployment
.
Strategy
,
DeleteStrategy
:
deployment
.
Strategy
,
DeleteStrategy
:
deployment
.
Strategy
,
Storage
:
storageInterface
,
Storage
:
storageInterface
,
DestroyFunc
:
dFunc
,
}
}
statusStore
:=
*
store
statusStore
:=
*
store
statusStore
.
UpdateStrategy
=
deployment
.
StatusStrategy
statusStore
.
UpdateStrategy
=
deployment
.
StatusStrategy
...
...
pkg/registry/deployment/etcd/etcd_test.go
View file @
5b11b598
...
@@ -93,6 +93,7 @@ var validDeployment = *validNewDeployment()
...
@@ -93,6 +93,7 @@ var validDeployment = *validNewDeployment()
func
TestCreate
(
t
*
testing
.
T
)
{
func
TestCreate
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Deployment
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Deployment
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Deployment
.
Store
)
deployment
:=
validNewDeployment
()
deployment
:=
validNewDeployment
()
deployment
.
ObjectMeta
=
api
.
ObjectMeta
{}
deployment
.
ObjectMeta
=
api
.
ObjectMeta
{}
...
@@ -112,6 +113,7 @@ func TestCreate(t *testing.T) {
...
@@ -112,6 +113,7 @@ func TestCreate(t *testing.T) {
func
TestUpdate
(
t
*
testing
.
T
)
{
func
TestUpdate
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Deployment
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Deployment
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Deployment
.
Store
)
test
.
TestUpdate
(
test
.
TestUpdate
(
// valid
// valid
...
@@ -144,6 +146,7 @@ func TestUpdate(t *testing.T) {
...
@@ -144,6 +146,7 @@ func TestUpdate(t *testing.T) {
func
TestDelete
(
t
*
testing
.
T
)
{
func
TestDelete
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Deployment
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Deployment
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Deployment
.
Store
)
test
.
TestDelete
(
validNewDeployment
())
test
.
TestDelete
(
validNewDeployment
())
}
}
...
@@ -151,6 +154,7 @@ func TestDelete(t *testing.T) {
...
@@ -151,6 +154,7 @@ func TestDelete(t *testing.T) {
func
TestGet
(
t
*
testing
.
T
)
{
func
TestGet
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Deployment
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Deployment
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Deployment
.
Store
)
test
.
TestGet
(
validNewDeployment
())
test
.
TestGet
(
validNewDeployment
())
}
}
...
@@ -158,6 +162,7 @@ func TestGet(t *testing.T) {
...
@@ -158,6 +162,7 @@ func TestGet(t *testing.T) {
func
TestList
(
t
*
testing
.
T
)
{
func
TestList
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Deployment
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Deployment
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Deployment
.
Store
)
test
.
TestList
(
validNewDeployment
())
test
.
TestList
(
validNewDeployment
())
}
}
...
@@ -165,6 +170,7 @@ func TestList(t *testing.T) {
...
@@ -165,6 +170,7 @@ func TestList(t *testing.T) {
func
TestWatch
(
t
*
testing
.
T
)
{
func
TestWatch
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Deployment
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Deployment
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Deployment
.
Store
)
test
.
TestWatch
(
test
.
TestWatch
(
validNewDeployment
(),
validNewDeployment
(),
...
@@ -190,7 +196,7 @@ func TestWatch(t *testing.T) {
...
@@ -190,7 +196,7 @@ func TestWatch(t *testing.T) {
func
TestScaleGet
(
t
*
testing
.
T
)
{
func
TestScaleGet
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Deployment
.
Store
.
DestroyFunc
()
var
deployment
extensions
.
Deployment
var
deployment
extensions
.
Deployment
ctx
:=
api
.
WithNamespace
(
api
.
NewContext
(),
namespace
)
ctx
:=
api
.
WithNamespace
(
api
.
NewContext
(),
namespace
)
key
:=
etcdtest
.
AddPrefix
(
"/deployments/"
+
namespace
+
"/"
+
name
)
key
:=
etcdtest
.
AddPrefix
(
"/deployments/"
+
namespace
+
"/"
+
name
)
...
@@ -227,7 +233,7 @@ func TestScaleGet(t *testing.T) {
...
@@ -227,7 +233,7 @@ func TestScaleGet(t *testing.T) {
func
TestScaleUpdate
(
t
*
testing
.
T
)
{
func
TestScaleUpdate
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Deployment
.
Store
.
DestroyFunc
()
var
deployment
extensions
.
Deployment
var
deployment
extensions
.
Deployment
ctx
:=
api
.
WithNamespace
(
api
.
NewContext
(),
namespace
)
ctx
:=
api
.
WithNamespace
(
api
.
NewContext
(),
namespace
)
key
:=
etcdtest
.
AddPrefix
(
"/deployments/"
+
namespace
+
"/"
+
name
)
key
:=
etcdtest
.
AddPrefix
(
"/deployments/"
+
namespace
+
"/"
+
name
)
...
@@ -265,7 +271,7 @@ func TestScaleUpdate(t *testing.T) {
...
@@ -265,7 +271,7 @@ func TestScaleUpdate(t *testing.T) {
func
TestStatusUpdate
(
t
*
testing
.
T
)
{
func
TestStatusUpdate
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Deployment
.
Store
.
DestroyFunc
()
ctx
:=
api
.
WithNamespace
(
api
.
NewContext
(),
namespace
)
ctx
:=
api
.
WithNamespace
(
api
.
NewContext
(),
namespace
)
key
:=
etcdtest
.
AddPrefix
(
"/deployments/"
+
namespace
+
"/"
+
name
)
key
:=
etcdtest
.
AddPrefix
(
"/deployments/"
+
namespace
+
"/"
+
name
)
if
err
:=
storage
.
Deployment
.
Storage
.
Create
(
ctx
,
key
,
&
validDeployment
,
nil
,
0
);
err
!=
nil
{
if
err
:=
storage
.
Deployment
.
Storage
.
Create
(
ctx
,
key
,
&
validDeployment
,
nil
,
0
);
err
!=
nil
{
...
@@ -348,6 +354,7 @@ func TestEtcdCreateDeploymentRollback(t *testing.T) {
...
@@ -348,6 +354,7 @@ func TestEtcdCreateDeploymentRollback(t *testing.T) {
t
.
Errorf
(
"%s: expected: %v, got: %v"
,
k
,
*
d
.
(
*
extensions
.
Deployment
)
.
Spec
.
RollbackTo
,
test
.
rollback
.
RollbackTo
)
t
.
Errorf
(
"%s: expected: %v, got: %v"
,
k
,
*
d
.
(
*
extensions
.
Deployment
)
.
Spec
.
RollbackTo
,
test
.
rollback
.
RollbackTo
)
}
}
}
}
storage
.
Deployment
.
Store
.
DestroyFunc
()
server
.
Terminate
(
t
)
server
.
Terminate
(
t
)
}
}
}
}
...
@@ -357,6 +364,7 @@ func TestEtcdCreateDeploymentRollback(t *testing.T) {
...
@@ -357,6 +364,7 @@ func TestEtcdCreateDeploymentRollback(t *testing.T) {
func
TestEtcdCreateDeploymentRollbackNoDeployment
(
t
*
testing
.
T
)
{
func
TestEtcdCreateDeploymentRollbackNoDeployment
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Deployment
.
Store
.
DestroyFunc
()
rollbackStorage
:=
storage
.
Rollback
rollbackStorage
:=
storage
.
Rollback
ctx
:=
api
.
WithNamespace
(
api
.
NewContext
(),
namespace
)
ctx
:=
api
.
WithNamespace
(
api
.
NewContext
(),
namespace
)
...
...
pkg/registry/endpoint/etcd/etcd.go
View file @
5b11b598
...
@@ -35,7 +35,7 @@ func NewREST(opts generic.RESTOptions) *REST {
...
@@ -35,7 +35,7 @@ func NewREST(opts generic.RESTOptions) *REST {
prefix
:=
"/"
+
opts
.
ResourcePrefix
prefix
:=
"/"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
EndpointsList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
EndpointsList
{}
}
storageInterface
,
_
:=
opts
.
Decorator
(
storageInterface
,
dFunc
:=
opts
.
Decorator
(
opts
.
StorageConfig
,
opts
.
StorageConfig
,
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
Endpoints
),
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
Endpoints
),
&
api
.
Endpoints
{},
&
api
.
Endpoints
{},
...
@@ -65,7 +65,8 @@ func NewREST(opts generic.RESTOptions) *REST {
...
@@ -65,7 +65,8 @@ func NewREST(opts generic.RESTOptions) *REST {
UpdateStrategy
:
endpoint
.
Strategy
,
UpdateStrategy
:
endpoint
.
Strategy
,
DeleteStrategy
:
endpoint
.
Strategy
,
DeleteStrategy
:
endpoint
.
Strategy
,
Storage
:
storageInterface
,
Storage
:
storageInterface
,
DestroyFunc
:
dFunc
,
}
}
return
&
REST
{
store
}
return
&
REST
{
store
}
}
}
pkg/registry/endpoint/etcd/etcd_test.go
View file @
5b11b598
...
@@ -60,6 +60,7 @@ func validChangedEndpoints() *api.Endpoints {
...
@@ -60,6 +60,7 @@ func validChangedEndpoints() *api.Endpoints {
func
TestCreate
(
t
*
testing
.
T
)
{
func
TestCreate
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
endpoints
:=
validNewEndpoints
()
endpoints
:=
validNewEndpoints
()
endpoints
.
ObjectMeta
=
api
.
ObjectMeta
{}
endpoints
.
ObjectMeta
=
api
.
ObjectMeta
{}
...
@@ -76,6 +77,7 @@ func TestCreate(t *testing.T) {
...
@@ -76,6 +77,7 @@ func TestCreate(t *testing.T) {
func
TestUpdate
(
t
*
testing
.
T
)
{
func
TestUpdate
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
AllowCreateOnUpdate
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
AllowCreateOnUpdate
()
test
.
TestUpdate
(
test
.
TestUpdate
(
// valid
// valid
...
@@ -95,6 +97,7 @@ func TestUpdate(t *testing.T) {
...
@@ -95,6 +97,7 @@ func TestUpdate(t *testing.T) {
func
TestDelete
(
t
*
testing
.
T
)
{
func
TestDelete
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestDelete
(
validNewEndpoints
())
test
.
TestDelete
(
validNewEndpoints
())
}
}
...
@@ -102,6 +105,7 @@ func TestDelete(t *testing.T) {
...
@@ -102,6 +105,7 @@ func TestDelete(t *testing.T) {
func
TestGet
(
t
*
testing
.
T
)
{
func
TestGet
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestGet
(
validNewEndpoints
())
test
.
TestGet
(
validNewEndpoints
())
}
}
...
@@ -109,6 +113,7 @@ func TestGet(t *testing.T) {
...
@@ -109,6 +113,7 @@ func TestGet(t *testing.T) {
func
TestList
(
t
*
testing
.
T
)
{
func
TestList
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestList
(
validNewEndpoints
())
test
.
TestList
(
validNewEndpoints
())
}
}
...
@@ -116,6 +121,7 @@ func TestList(t *testing.T) {
...
@@ -116,6 +121,7 @@ func TestList(t *testing.T) {
func
TestWatch
(
t
*
testing
.
T
)
{
func
TestWatch
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestWatch
(
test
.
TestWatch
(
validNewEndpoints
(),
validNewEndpoints
(),
...
...
pkg/registry/event/etcd/etcd.go
View file @
5b11b598
...
@@ -34,7 +34,7 @@ func NewREST(opts generic.RESTOptions, ttl uint64) *REST {
...
@@ -34,7 +34,7 @@ func NewREST(opts generic.RESTOptions, ttl uint64) *REST {
// We explicitly do NOT do any decoration here - switching on Cacher
// We explicitly do NOT do any decoration here - switching on Cacher
// for events will lead to too high memory consumption.
// for events will lead to too high memory consumption.
storageInterface
,
_
:=
generic
.
NewRawStorage
(
opts
.
StorageConfig
)
storageInterface
,
dFunc
:=
generic
.
NewRawStorage
(
opts
.
StorageConfig
)
store
:=
&
registry
.
Store
{
store
:=
&
registry
.
Store
{
NewFunc
:
func
()
runtime
.
Object
{
return
&
api
.
Event
{}
},
NewFunc
:
func
()
runtime
.
Object
{
return
&
api
.
Event
{}
},
...
@@ -59,7 +59,8 @@ func NewREST(opts generic.RESTOptions, ttl uint64) *REST {
...
@@ -59,7 +59,8 @@ func NewREST(opts generic.RESTOptions, ttl uint64) *REST {
UpdateStrategy
:
event
.
Strategy
,
UpdateStrategy
:
event
.
Strategy
,
DeleteStrategy
:
event
.
Strategy
,
DeleteStrategy
:
event
.
Strategy
,
Storage
:
storageInterface
,
Storage
:
storageInterface
,
DestroyFunc
:
dFunc
,
}
}
return
&
REST
{
store
}
return
&
REST
{
store
}
}
}
pkg/registry/event/etcd/etcd_test.go
View file @
5b11b598
...
@@ -51,6 +51,7 @@ func validNewEvent(namespace string) *api.Event {
...
@@ -51,6 +51,7 @@ func validNewEvent(namespace string) *api.Event {
func
TestCreate
(
t
*
testing
.
T
)
{
func
TestCreate
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
event
:=
validNewEvent
(
test
.
TestNamespace
())
event
:=
validNewEvent
(
test
.
TestNamespace
())
event
.
ObjectMeta
=
api
.
ObjectMeta
{}
event
.
ObjectMeta
=
api
.
ObjectMeta
{}
...
@@ -65,6 +66,7 @@ func TestCreate(t *testing.T) {
...
@@ -65,6 +66,7 @@ func TestCreate(t *testing.T) {
func
TestUpdate
(
t
*
testing
.
T
)
{
func
TestUpdate
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
AllowCreateOnUpdate
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
AllowCreateOnUpdate
()
test
.
TestUpdate
(
test
.
TestUpdate
(
// valid
// valid
...
@@ -87,6 +89,7 @@ func TestUpdate(t *testing.T) {
...
@@ -87,6 +89,7 @@ func TestUpdate(t *testing.T) {
func
TestDelete
(
t
*
testing
.
T
)
{
func
TestDelete
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestDelete
(
validNewEvent
(
test
.
TestNamespace
()))
test
.
TestDelete
(
validNewEvent
(
test
.
TestNamespace
()))
}
}
pkg/registry/generic/registry/store.go
View file @
5b11b598
...
@@ -90,6 +90,9 @@ type Store struct {
...
@@ -90,6 +90,9 @@ type Store struct {
// Returns a matcher corresponding to the provided labels and fields.
// Returns a matcher corresponding to the provided labels and fields.
PredicateFunc
func
(
label
labels
.
Selector
,
field
fields
.
Selector
)
*
generic
.
SelectionPredicate
PredicateFunc
func
(
label
labels
.
Selector
,
field
fields
.
Selector
)
*
generic
.
SelectionPredicate
// Called to cleanup storage clients.
DestroyFunc
func
()
// DeleteCollectionWorkers is the maximum number of workers in a single
// DeleteCollectionWorkers is the maximum number of workers in a single
// DeleteCollection call.
// DeleteCollection call.
DeleteCollectionWorkers
int
DeleteCollectionWorkers
int
...
...
pkg/registry/generic/registry/store_test.go
View file @
5b11b598
...
@@ -1200,11 +1200,14 @@ func newTestGenericStoreRegistry(t *testing.T, hasCacheEnabled bool) (factory.De
...
@@ -1200,11 +1200,14 @@ func newTestGenericStoreRegistry(t *testing.T, hasCacheEnabled bool) (factory.De
strategy
:=
&
testRESTStrategy
{
api
.
Scheme
,
api
.
SimpleNameGenerator
,
true
,
false
,
true
}
strategy
:=
&
testRESTStrategy
{
api
.
Scheme
,
api
.
SimpleNameGenerator
,
true
,
false
,
true
}
sc
.
Codec
=
testapi
.
Default
.
StorageCodec
()
sc
.
Codec
=
testapi
.
Default
.
StorageCodec
()
destroyFunc
:=
func
()
{}
s
,
dFunc
,
err
:=
factory
.
Create
(
*
sc
)
s
,
err
:=
factory
.
Create
(
*
sc
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatalf
(
"Error creating storage: %v"
,
err
)
t
.
Fatalf
(
"Error creating storage: %v"
,
err
)
}
}
destroyFunc
:=
func
()
{
dFunc
()
server
.
Terminate
(
t
)
}
if
hasCacheEnabled
{
if
hasCacheEnabled
{
config
:=
storage
.
CacherConfig
{
config
:=
storage
.
CacherConfig
{
CacheCapacity
:
10
,
CacheCapacity
:
10
,
...
...
pkg/registry/horizontalpodautoscaler/etcd/etcd.go
View file @
5b11b598
...
@@ -37,7 +37,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
...
@@ -37,7 +37,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
prefix
:=
"/"
+
opts
.
ResourcePrefix
prefix
:=
"/"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
autoscaling
.
HorizontalPodAutoscalerList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
autoscaling
.
HorizontalPodAutoscalerList
{}
}
storageInterface
,
_
:=
opts
.
Decorator
(
storageInterface
,
dFunc
:=
opts
.
Decorator
(
opts
.
StorageConfig
,
opts
.
StorageConfig
,
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
HorizontalPodAutoscalers
),
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
HorizontalPodAutoscalers
),
&
autoscaling
.
HorizontalPodAutoscaler
{},
&
autoscaling
.
HorizontalPodAutoscaler
{},
...
@@ -77,7 +77,8 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
...
@@ -77,7 +77,8 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
UpdateStrategy
:
horizontalpodautoscaler
.
Strategy
,
UpdateStrategy
:
horizontalpodautoscaler
.
Strategy
,
DeleteStrategy
:
horizontalpodautoscaler
.
Strategy
,
DeleteStrategy
:
horizontalpodautoscaler
.
Strategy
,
Storage
:
storageInterface
,
Storage
:
storageInterface
,
DestroyFunc
:
dFunc
,
}
}
statusStore
:=
*
store
statusStore
:=
*
store
statusStore
.
UpdateStrategy
=
horizontalpodautoscaler
.
StatusStrategy
statusStore
.
UpdateStrategy
=
horizontalpodautoscaler
.
StatusStrategy
...
...
pkg/registry/horizontalpodautoscaler/etcd/etcd_test.go
View file @
5b11b598
...
@@ -59,6 +59,7 @@ func validNewHorizontalPodAutoscaler(name string) *autoscaling.HorizontalPodAuto
...
@@ -59,6 +59,7 @@ func validNewHorizontalPodAutoscaler(name string) *autoscaling.HorizontalPodAuto
func
TestCreate
(
t
*
testing
.
T
)
{
func
TestCreate
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
autoscaler
:=
validNewHorizontalPodAutoscaler
(
"foo"
)
autoscaler
:=
validNewHorizontalPodAutoscaler
(
"foo"
)
autoscaler
.
ObjectMeta
=
api
.
ObjectMeta
{}
autoscaler
.
ObjectMeta
=
api
.
ObjectMeta
{}
...
@@ -73,6 +74,7 @@ func TestCreate(t *testing.T) {
...
@@ -73,6 +74,7 @@ func TestCreate(t *testing.T) {
func
TestUpdate
(
t
*
testing
.
T
)
{
func
TestUpdate
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestUpdate
(
test
.
TestUpdate
(
// valid
// valid
...
@@ -89,6 +91,7 @@ func TestUpdate(t *testing.T) {
...
@@ -89,6 +91,7 @@ func TestUpdate(t *testing.T) {
func
TestDelete
(
t
*
testing
.
T
)
{
func
TestDelete
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestDelete
(
validNewHorizontalPodAutoscaler
(
"foo"
))
test
.
TestDelete
(
validNewHorizontalPodAutoscaler
(
"foo"
))
}
}
...
@@ -96,6 +99,7 @@ func TestDelete(t *testing.T) {
...
@@ -96,6 +99,7 @@ func TestDelete(t *testing.T) {
func
TestGet
(
t
*
testing
.
T
)
{
func
TestGet
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestGet
(
validNewHorizontalPodAutoscaler
(
"foo"
))
test
.
TestGet
(
validNewHorizontalPodAutoscaler
(
"foo"
))
}
}
...
@@ -103,6 +107,7 @@ func TestGet(t *testing.T) {
...
@@ -103,6 +107,7 @@ func TestGet(t *testing.T) {
func
TestList
(
t
*
testing
.
T
)
{
func
TestList
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestList
(
validNewHorizontalPodAutoscaler
(
"foo"
))
test
.
TestList
(
validNewHorizontalPodAutoscaler
(
"foo"
))
}
}
...
@@ -110,6 +115,7 @@ func TestList(t *testing.T) {
...
@@ -110,6 +115,7 @@ func TestList(t *testing.T) {
func
TestWatch
(
t
*
testing
.
T
)
{
func
TestWatch
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestWatch
(
test
.
TestWatch
(
validNewHorizontalPodAutoscaler
(
"foo"
),
validNewHorizontalPodAutoscaler
(
"foo"
),
...
...
pkg/registry/ingress/etcd/etcd.go
View file @
5b11b598
...
@@ -38,7 +38,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
...
@@ -38,7 +38,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
prefix
:=
"/"
+
opts
.
ResourcePrefix
prefix
:=
"/"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
extensions
.
IngressList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
extensions
.
IngressList
{}
}
storageInterface
,
_
:=
opts
.
Decorator
(
storageInterface
,
dFunc
:=
opts
.
Decorator
(
opts
.
StorageConfig
,
opts
.
StorageConfig
,
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
Ingress
),
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
Ingress
),
&
extensions
.
Ingress
{},
&
extensions
.
Ingress
{},
...
@@ -79,7 +79,8 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
...
@@ -79,7 +79,8 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
UpdateStrategy
:
ingress
.
Strategy
,
UpdateStrategy
:
ingress
.
Strategy
,
DeleteStrategy
:
ingress
.
Strategy
,
DeleteStrategy
:
ingress
.
Strategy
,
Storage
:
storageInterface
,
Storage
:
storageInterface
,
DestroyFunc
:
dFunc
,
}
}
statusStore
:=
*
store
statusStore
:=
*
store
statusStore
.
UpdateStrategy
=
ingress
.
StatusStrategy
statusStore
.
UpdateStrategy
=
ingress
.
StatusStrategy
...
...
pkg/registry/ingress/etcd/etcd_test.go
View file @
5b11b598
...
@@ -115,6 +115,7 @@ func validIngress() *extensions.Ingress {
...
@@ -115,6 +115,7 @@ func validIngress() *extensions.Ingress {
func
TestCreate
(
t
*
testing
.
T
)
{
func
TestCreate
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
ingress
:=
validIngress
()
ingress
:=
validIngress
()
noDefaultBackendAndRules
:=
validIngress
()
noDefaultBackendAndRules
:=
validIngress
()
...
@@ -134,6 +135,7 @@ func TestCreate(t *testing.T) {
...
@@ -134,6 +135,7 @@ func TestCreate(t *testing.T) {
func
TestUpdate
(
t
*
testing
.
T
)
{
func
TestUpdate
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestUpdate
(
test
.
TestUpdate
(
// valid
// valid
...
@@ -169,6 +171,7 @@ func TestUpdate(t *testing.T) {
...
@@ -169,6 +171,7 @@ func TestUpdate(t *testing.T) {
func
TestDelete
(
t
*
testing
.
T
)
{
func
TestDelete
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestDelete
(
validIngress
())
test
.
TestDelete
(
validIngress
())
}
}
...
@@ -176,6 +179,7 @@ func TestDelete(t *testing.T) {
...
@@ -176,6 +179,7 @@ func TestDelete(t *testing.T) {
func
TestGet
(
t
*
testing
.
T
)
{
func
TestGet
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestGet
(
validIngress
())
test
.
TestGet
(
validIngress
())
}
}
...
@@ -183,6 +187,7 @@ func TestGet(t *testing.T) {
...
@@ -183,6 +187,7 @@ func TestGet(t *testing.T) {
func
TestList
(
t
*
testing
.
T
)
{
func
TestList
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestList
(
validIngress
())
test
.
TestList
(
validIngress
())
}
}
...
@@ -190,6 +195,7 @@ func TestList(t *testing.T) {
...
@@ -190,6 +195,7 @@ func TestList(t *testing.T) {
func
TestWatch
(
t
*
testing
.
T
)
{
func
TestWatch
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestWatch
(
test
.
TestWatch
(
validIngress
(),
validIngress
(),
...
...
pkg/registry/job/etcd/etcd.go
View file @
5b11b598
...
@@ -38,7 +38,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
...
@@ -38,7 +38,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
prefix
:=
"/"
+
opts
.
ResourcePrefix
prefix
:=
"/"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
batch
.
JobList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
batch
.
JobList
{}
}
storageInterface
,
_
:=
opts
.
Decorator
(
storageInterface
,
dFunc
:=
opts
.
Decorator
(
opts
.
StorageConfig
,
opts
.
StorageConfig
,
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
Jobs
),
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
Jobs
),
&
batch
.
Job
{},
&
batch
.
Job
{},
...
@@ -79,7 +79,8 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
...
@@ -79,7 +79,8 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
UpdateStrategy
:
job
.
Strategy
,
UpdateStrategy
:
job
.
Strategy
,
DeleteStrategy
:
job
.
Strategy
,
DeleteStrategy
:
job
.
Strategy
,
Storage
:
storageInterface
,
Storage
:
storageInterface
,
DestroyFunc
:
dFunc
,
}
}
statusStore
:=
*
store
statusStore
:=
*
store
...
...
pkg/registry/job/etcd/etcd_test.go
View file @
5b11b598
...
@@ -76,6 +76,7 @@ func validNewJob() *batch.Job {
...
@@ -76,6 +76,7 @@ func validNewJob() *batch.Job {
func
TestCreate
(
t
*
testing
.
T
)
{
func
TestCreate
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
validJob
:=
validNewJob
()
validJob
:=
validNewJob
()
validJob
.
ObjectMeta
=
api
.
ObjectMeta
{}
validJob
.
ObjectMeta
=
api
.
ObjectMeta
{}
...
@@ -96,6 +97,7 @@ func TestCreate(t *testing.T) {
...
@@ -96,6 +97,7 @@ func TestCreate(t *testing.T) {
func
TestUpdate
(
t
*
testing
.
T
)
{
func
TestUpdate
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
two
:=
int32
(
2
)
two
:=
int32
(
2
)
test
.
TestUpdate
(
test
.
TestUpdate
(
...
@@ -124,6 +126,7 @@ func TestUpdate(t *testing.T) {
...
@@ -124,6 +126,7 @@ func TestUpdate(t *testing.T) {
func
TestDelete
(
t
*
testing
.
T
)
{
func
TestDelete
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestDelete
(
validNewJob
())
test
.
TestDelete
(
validNewJob
())
}
}
...
@@ -131,6 +134,7 @@ func TestDelete(t *testing.T) {
...
@@ -131,6 +134,7 @@ func TestDelete(t *testing.T) {
func
TestGet
(
t
*
testing
.
T
)
{
func
TestGet
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestGet
(
validNewJob
())
test
.
TestGet
(
validNewJob
())
}
}
...
@@ -138,6 +142,7 @@ func TestGet(t *testing.T) {
...
@@ -138,6 +142,7 @@ func TestGet(t *testing.T) {
func
TestList
(
t
*
testing
.
T
)
{
func
TestList
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestList
(
validNewJob
())
test
.
TestList
(
validNewJob
())
}
}
...
@@ -145,6 +150,7 @@ func TestList(t *testing.T) {
...
@@ -145,6 +150,7 @@ func TestList(t *testing.T) {
func
TestWatch
(
t
*
testing
.
T
)
{
func
TestWatch
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestWatch
(
test
.
TestWatch
(
validNewJob
(),
validNewJob
(),
...
...
pkg/registry/limitrange/etcd/etcd.go
View file @
5b11b598
...
@@ -35,7 +35,7 @@ func NewREST(opts generic.RESTOptions) *REST {
...
@@ -35,7 +35,7 @@ func NewREST(opts generic.RESTOptions) *REST {
prefix
:=
"/"
+
opts
.
ResourcePrefix
prefix
:=
"/"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
LimitRangeList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
LimitRangeList
{}
}
storageInterface
,
_
:=
opts
.
Decorator
(
storageInterface
,
dFunc
:=
opts
.
Decorator
(
opts
.
StorageConfig
,
opts
.
StorageConfig
,
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
LimitRanges
),
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
LimitRanges
),
&
api
.
LimitRange
{},
&
api
.
LimitRange
{},
...
@@ -66,7 +66,8 @@ func NewREST(opts generic.RESTOptions) *REST {
...
@@ -66,7 +66,8 @@ func NewREST(opts generic.RESTOptions) *REST {
DeleteStrategy
:
limitrange
.
Strategy
,
DeleteStrategy
:
limitrange
.
Strategy
,
ExportStrategy
:
limitrange
.
Strategy
,
ExportStrategy
:
limitrange
.
Strategy
,
Storage
:
storageInterface
,
Storage
:
storageInterface
,
DestroyFunc
:
dFunc
,
}
}
return
&
REST
{
store
}
return
&
REST
{
store
}
}
}
pkg/registry/limitrange/etcd/etcd_test.go
View file @
5b11b598
...
@@ -62,6 +62,7 @@ func validNewLimitRange() *api.LimitRange {
...
@@ -62,6 +62,7 @@ func validNewLimitRange() *api.LimitRange {
func
TestCreate
(
t
*
testing
.
T
)
{
func
TestCreate
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
GeneratesName
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
GeneratesName
()
validLimitRange
:=
validNewLimitRange
()
validLimitRange
:=
validNewLimitRange
()
validLimitRange
.
ObjectMeta
=
api
.
ObjectMeta
{}
validLimitRange
.
ObjectMeta
=
api
.
ObjectMeta
{}
...
@@ -78,6 +79,7 @@ func TestCreate(t *testing.T) {
...
@@ -78,6 +79,7 @@ func TestCreate(t *testing.T) {
func
TestUpdate
(
t
*
testing
.
T
)
{
func
TestUpdate
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
AllowCreateOnUpdate
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
AllowCreateOnUpdate
()
test
.
TestUpdate
(
test
.
TestUpdate
(
// valid
// valid
...
@@ -106,6 +108,7 @@ func TestUpdate(t *testing.T) {
...
@@ -106,6 +108,7 @@ func TestUpdate(t *testing.T) {
func
TestDelete
(
t
*
testing
.
T
)
{
func
TestDelete
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestDelete
(
validNewLimitRange
())
test
.
TestDelete
(
validNewLimitRange
())
}
}
...
@@ -113,6 +116,7 @@ func TestDelete(t *testing.T) {
...
@@ -113,6 +116,7 @@ func TestDelete(t *testing.T) {
func
TestGet
(
t
*
testing
.
T
)
{
func
TestGet
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestGet
(
validNewLimitRange
())
test
.
TestGet
(
validNewLimitRange
())
}
}
...
@@ -120,6 +124,7 @@ func TestGet(t *testing.T) {
...
@@ -120,6 +124,7 @@ func TestGet(t *testing.T) {
func
TestList
(
t
*
testing
.
T
)
{
func
TestList
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestList
(
validNewLimitRange
())
test
.
TestList
(
validNewLimitRange
())
}
}
...
@@ -127,6 +132,7 @@ func TestList(t *testing.T) {
...
@@ -127,6 +132,7 @@ func TestList(t *testing.T) {
func
TestWatch
(
t
*
testing
.
T
)
{
func
TestWatch
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestWatch
(
test
.
TestWatch
(
validNewLimitRange
(),
validNewLimitRange
(),
...
...
pkg/registry/namespace/etcd/etcd.go
View file @
5b11b598
...
@@ -53,7 +53,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST, *FinalizeREST) {
...
@@ -53,7 +53,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST, *FinalizeREST) {
prefix
:=
"/"
+
opts
.
ResourcePrefix
prefix
:=
"/"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
NamespaceList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
NamespaceList
{}
}
storageInterface
,
_
:=
opts
.
Decorator
(
storageInterface
,
dFunc
:=
opts
.
Decorator
(
opts
.
StorageConfig
,
opts
.
StorageConfig
,
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
Namespaces
),
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
Namespaces
),
&
api
.
Namespace
{},
&
api
.
Namespace
{},
...
@@ -84,7 +84,8 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST, *FinalizeREST) {
...
@@ -84,7 +84,8 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST, *FinalizeREST) {
DeleteStrategy
:
namespace
.
Strategy
,
DeleteStrategy
:
namespace
.
Strategy
,
ReturnDeletedObject
:
true
,
ReturnDeletedObject
:
true
,
Storage
:
storageInterface
,
Storage
:
storageInterface
,
DestroyFunc
:
dFunc
,
}
}
statusStore
:=
*
store
statusStore
:=
*
store
...
...
pkg/registry/namespace/etcd/etcd_test.go
View file @
5b11b598
...
@@ -47,6 +47,7 @@ func validNewNamespace() *api.Namespace {
...
@@ -47,6 +47,7 @@ func validNewNamespace() *api.Namespace {
func
TestCreate
(
t
*
testing
.
T
)
{
func
TestCreate
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
namespace
:=
validNewNamespace
()
namespace
:=
validNewNamespace
()
namespace
.
ObjectMeta
=
api
.
ObjectMeta
{
GenerateName
:
"foo"
}
namespace
.
ObjectMeta
=
api
.
ObjectMeta
{
GenerateName
:
"foo"
}
...
@@ -63,6 +64,7 @@ func TestCreate(t *testing.T) {
...
@@ -63,6 +64,7 @@ func TestCreate(t *testing.T) {
func
TestCreateSetsFields
(
t
*
testing
.
T
)
{
func
TestCreateSetsFields
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
namespace
:=
validNewNamespace
()
namespace
:=
validNewNamespace
()
ctx
:=
api
.
NewContext
()
ctx
:=
api
.
NewContext
()
_
,
err
:=
storage
.
Create
(
ctx
,
namespace
)
_
,
err
:=
storage
.
Create
(
ctx
,
namespace
)
...
@@ -89,6 +91,7 @@ func TestCreateSetsFields(t *testing.T) {
...
@@ -89,6 +91,7 @@ func TestCreateSetsFields(t *testing.T) {
func
TestDelete
(
t
*
testing
.
T
)
{
func
TestDelete
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
.
ReturnDeletedObject
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
.
ReturnDeletedObject
()
test
.
TestDelete
(
validNewNamespace
())
test
.
TestDelete
(
validNewNamespace
())
}
}
...
@@ -96,6 +99,7 @@ func TestDelete(t *testing.T) {
...
@@ -96,6 +99,7 @@ func TestDelete(t *testing.T) {
func
TestGet
(
t
*
testing
.
T
)
{
func
TestGet
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
.
TestGet
(
validNewNamespace
())
test
.
TestGet
(
validNewNamespace
())
}
}
...
@@ -103,6 +107,7 @@ func TestGet(t *testing.T) {
...
@@ -103,6 +107,7 @@ func TestGet(t *testing.T) {
func
TestList
(
t
*
testing
.
T
)
{
func
TestList
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
.
TestList
(
validNewNamespace
())
test
.
TestList
(
validNewNamespace
())
}
}
...
@@ -110,6 +115,7 @@ func TestList(t *testing.T) {
...
@@ -110,6 +115,7 @@ func TestList(t *testing.T) {
func
TestWatch
(
t
*
testing
.
T
)
{
func
TestWatch
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
.
TestWatch
(
test
.
TestWatch
(
validNewNamespace
(),
validNewNamespace
(),
...
@@ -134,6 +140,7 @@ func TestWatch(t *testing.T) {
...
@@ -134,6 +140,7 @@ func TestWatch(t *testing.T) {
func
TestDeleteNamespaceWithIncompleteFinalizers
(
t
*
testing
.
T
)
{
func
TestDeleteNamespaceWithIncompleteFinalizers
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
key
:=
etcdtest
.
AddPrefix
(
"namespaces/foo"
)
key
:=
etcdtest
.
AddPrefix
(
"namespaces/foo"
)
ctx
:=
api
.
NewContext
()
ctx
:=
api
.
NewContext
()
now
:=
unversioned
.
Now
()
now
:=
unversioned
.
Now
()
...
@@ -158,6 +165,7 @@ func TestDeleteNamespaceWithIncompleteFinalizers(t *testing.T) {
...
@@ -158,6 +165,7 @@ func TestDeleteNamespaceWithIncompleteFinalizers(t *testing.T) {
func
TestDeleteNamespaceWithCompleteFinalizers
(
t
*
testing
.
T
)
{
func
TestDeleteNamespaceWithCompleteFinalizers
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
key
:=
etcdtest
.
AddPrefix
(
"namespaces/foo"
)
key
:=
etcdtest
.
AddPrefix
(
"namespaces/foo"
)
ctx
:=
api
.
NewContext
()
ctx
:=
api
.
NewContext
()
now
:=
unversioned
.
Now
()
now
:=
unversioned
.
Now
()
...
...
pkg/registry/networkpolicy/etcd/etcd.go
View file @
5b11b598
...
@@ -37,7 +37,7 @@ func NewREST(opts generic.RESTOptions) *REST {
...
@@ -37,7 +37,7 @@ func NewREST(opts generic.RESTOptions) *REST {
prefix
:=
"/"
+
opts
.
ResourcePrefix
prefix
:=
"/"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
extensionsapi
.
NetworkPolicyList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
extensionsapi
.
NetworkPolicyList
{}
}
storageInterface
,
_
:=
opts
.
Decorator
(
storageInterface
,
dFunc
:=
opts
.
Decorator
(
opts
.
StorageConfig
,
opts
.
StorageConfig
,
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
NetworkPolicys
),
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
NetworkPolicys
),
&
extensionsapi
.
NetworkPolicy
{},
&
extensionsapi
.
NetworkPolicy
{},
...
@@ -78,7 +78,8 @@ func NewREST(opts generic.RESTOptions) *REST {
...
@@ -78,7 +78,8 @@ func NewREST(opts generic.RESTOptions) *REST {
UpdateStrategy
:
networkpolicy
.
Strategy
,
UpdateStrategy
:
networkpolicy
.
Strategy
,
DeleteStrategy
:
networkpolicy
.
Strategy
,
DeleteStrategy
:
networkpolicy
.
Strategy
,
Storage
:
storageInterface
,
Storage
:
storageInterface
,
DestroyFunc
:
dFunc
,
}
}
return
&
REST
{
store
}
return
&
REST
{
store
}
}
}
pkg/registry/networkpolicy/etcd/etcd_test.go
View file @
5b11b598
...
@@ -81,6 +81,7 @@ var validNetworkPolicy = *validNewNetworkPolicy()
...
@@ -81,6 +81,7 @@ var validNetworkPolicy = *validNewNetworkPolicy()
func
TestCreate
(
t
*
testing
.
T
)
{
func
TestCreate
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
np
:=
validNewNetworkPolicy
()
np
:=
validNewNetworkPolicy
()
np
.
ObjectMeta
=
api
.
ObjectMeta
{}
np
.
ObjectMeta
=
api
.
ObjectMeta
{}
...
@@ -102,6 +103,7 @@ func TestCreate(t *testing.T) {
...
@@ -102,6 +103,7 @@ func TestCreate(t *testing.T) {
func
TestUpdate
(
t
*
testing
.
T
)
{
func
TestUpdate
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestUpdate
(
test
.
TestUpdate
(
// valid
// valid
...
@@ -128,6 +130,7 @@ func TestUpdate(t *testing.T) {
...
@@ -128,6 +130,7 @@ func TestUpdate(t *testing.T) {
func
TestDelete
(
t
*
testing
.
T
)
{
func
TestDelete
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestDelete
(
validNewNetworkPolicy
())
test
.
TestDelete
(
validNewNetworkPolicy
())
}
}
...
@@ -135,6 +138,7 @@ func TestDelete(t *testing.T) {
...
@@ -135,6 +138,7 @@ func TestDelete(t *testing.T) {
func
TestGet
(
t
*
testing
.
T
)
{
func
TestGet
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestGet
(
validNewNetworkPolicy
())
test
.
TestGet
(
validNewNetworkPolicy
())
}
}
...
@@ -142,6 +146,7 @@ func TestGet(t *testing.T) {
...
@@ -142,6 +146,7 @@ func TestGet(t *testing.T) {
func
TestList
(
t
*
testing
.
T
)
{
func
TestList
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestList
(
validNewNetworkPolicy
())
test
.
TestList
(
validNewNetworkPolicy
())
}
}
...
@@ -149,6 +154,7 @@ func TestList(t *testing.T) {
...
@@ -149,6 +154,7 @@ func TestList(t *testing.T) {
func
TestWatch
(
t
*
testing
.
T
)
{
func
TestWatch
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestWatch
(
test
.
TestWatch
(
validNewNetworkPolicy
(),
validNewNetworkPolicy
(),
...
...
pkg/registry/node/etcd/etcd.go
View file @
5b11b598
...
@@ -69,7 +69,7 @@ func NewStorage(opts generic.RESTOptions, connection client.ConnectionInfoGetter
...
@@ -69,7 +69,7 @@ func NewStorage(opts generic.RESTOptions, connection client.ConnectionInfoGetter
prefix
:=
"/"
+
opts
.
ResourcePrefix
prefix
:=
"/"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
NodeList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
NodeList
{}
}
storageInterface
,
_
:=
opts
.
Decorator
(
storageInterface
,
dFunc
:=
opts
.
Decorator
(
opts
.
StorageConfig
,
opts
.
StorageConfig
,
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
Nodes
),
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
Nodes
),
&
api
.
Node
{},
&
api
.
Node
{},
...
@@ -99,7 +99,8 @@ func NewStorage(opts generic.RESTOptions, connection client.ConnectionInfoGetter
...
@@ -99,7 +99,8 @@ func NewStorage(opts generic.RESTOptions, connection client.ConnectionInfoGetter
DeleteStrategy
:
node
.
Strategy
,
DeleteStrategy
:
node
.
Strategy
,
ExportStrategy
:
node
.
Strategy
,
ExportStrategy
:
node
.
Strategy
,
Storage
:
storageInterface
,
Storage
:
storageInterface
,
DestroyFunc
:
dFunc
,
}
}
statusStore
:=
*
store
statusStore
:=
*
store
...
...
pkg/registry/node/etcd/etcd_test.go
View file @
5b11b598
...
@@ -67,6 +67,7 @@ func validNewNode() *api.Node {
...
@@ -67,6 +67,7 @@ func validNewNode() *api.Node {
func
TestCreate
(
t
*
testing
.
T
)
{
func
TestCreate
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
node
:=
validNewNode
()
node
:=
validNewNode
()
node
.
ObjectMeta
=
api
.
ObjectMeta
{
GenerateName
:
"foo"
}
node
.
ObjectMeta
=
api
.
ObjectMeta
{
GenerateName
:
"foo"
}
...
@@ -83,6 +84,7 @@ func TestCreate(t *testing.T) {
...
@@ -83,6 +84,7 @@ func TestCreate(t *testing.T) {
func
TestUpdate
(
t
*
testing
.
T
)
{
func
TestUpdate
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
.
TestUpdate
(
test
.
TestUpdate
(
// valid
// valid
...
@@ -99,6 +101,7 @@ func TestUpdate(t *testing.T) {
...
@@ -99,6 +101,7 @@ func TestUpdate(t *testing.T) {
func
TestDelete
(
t
*
testing
.
T
)
{
func
TestDelete
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
.
TestDelete
(
validNewNode
())
test
.
TestDelete
(
validNewNode
())
}
}
...
@@ -106,6 +109,7 @@ func TestDelete(t *testing.T) {
...
@@ -106,6 +109,7 @@ func TestDelete(t *testing.T) {
func
TestGet
(
t
*
testing
.
T
)
{
func
TestGet
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
.
TestGet
(
validNewNode
())
test
.
TestGet
(
validNewNode
())
}
}
...
@@ -113,6 +117,7 @@ func TestGet(t *testing.T) {
...
@@ -113,6 +117,7 @@ func TestGet(t *testing.T) {
func
TestList
(
t
*
testing
.
T
)
{
func
TestList
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
.
TestList
(
validNewNode
())
test
.
TestList
(
validNewNode
())
}
}
...
@@ -120,6 +125,7 @@ func TestList(t *testing.T) {
...
@@ -120,6 +125,7 @@ func TestList(t *testing.T) {
func
TestWatch
(
t
*
testing
.
T
)
{
func
TestWatch
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
.
TestWatch
(
test
.
TestWatch
(
validNewNode
(),
validNewNode
(),
...
...
pkg/registry/persistentvolume/etcd/etcd.go
View file @
5b11b598
...
@@ -36,7 +36,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
...
@@ -36,7 +36,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
prefix
:=
"/"
+
opts
.
ResourcePrefix
prefix
:=
"/"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
PersistentVolumeList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
PersistentVolumeList
{}
}
storageInterface
,
_
:=
opts
.
Decorator
(
storageInterface
,
dFunc
:=
opts
.
Decorator
(
opts
.
StorageConfig
,
opts
.
StorageConfig
,
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
PersistentVolumes
),
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
PersistentVolumes
),
&
api
.
PersistentVolume
{},
&
api
.
PersistentVolume
{},
...
@@ -67,7 +67,8 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
...
@@ -67,7 +67,8 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
DeleteStrategy
:
persistentvolume
.
Strategy
,
DeleteStrategy
:
persistentvolume
.
Strategy
,
ReturnDeletedObject
:
true
,
ReturnDeletedObject
:
true
,
Storage
:
storageInterface
,
Storage
:
storageInterface
,
DestroyFunc
:
dFunc
,
}
}
statusStore
:=
*
store
statusStore
:=
*
store
...
...
pkg/registry/persistentvolume/etcd/etcd_test.go
View file @
5b11b598
...
@@ -71,6 +71,7 @@ func validChangedPersistentVolume() *api.PersistentVolume {
...
@@ -71,6 +71,7 @@ func validChangedPersistentVolume() *api.PersistentVolume {
func
TestCreate
(
t
*
testing
.
T
)
{
func
TestCreate
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
pv
:=
validNewPersistentVolume
(
"foo"
)
pv
:=
validNewPersistentVolume
(
"foo"
)
pv
.
ObjectMeta
=
api
.
ObjectMeta
{
GenerateName
:
"foo"
}
pv
.
ObjectMeta
=
api
.
ObjectMeta
{
GenerateName
:
"foo"
}
...
@@ -87,6 +88,7 @@ func TestCreate(t *testing.T) {
...
@@ -87,6 +88,7 @@ func TestCreate(t *testing.T) {
func
TestUpdate
(
t
*
testing
.
T
)
{
func
TestUpdate
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
.
TestUpdate
(
test
.
TestUpdate
(
// valid
// valid
...
@@ -105,6 +107,7 @@ func TestUpdate(t *testing.T) {
...
@@ -105,6 +107,7 @@ func TestUpdate(t *testing.T) {
func
TestDelete
(
t
*
testing
.
T
)
{
func
TestDelete
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
.
ReturnDeletedObject
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
.
ReturnDeletedObject
()
test
.
TestDelete
(
validNewPersistentVolume
(
"foo"
))
test
.
TestDelete
(
validNewPersistentVolume
(
"foo"
))
}
}
...
@@ -112,6 +115,7 @@ func TestDelete(t *testing.T) {
...
@@ -112,6 +115,7 @@ func TestDelete(t *testing.T) {
func
TestGet
(
t
*
testing
.
T
)
{
func
TestGet
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
.
TestGet
(
validNewPersistentVolume
(
"foo"
))
test
.
TestGet
(
validNewPersistentVolume
(
"foo"
))
}
}
...
@@ -119,6 +123,7 @@ func TestGet(t *testing.T) {
...
@@ -119,6 +123,7 @@ func TestGet(t *testing.T) {
func
TestList
(
t
*
testing
.
T
)
{
func
TestList
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
.
TestList
(
validNewPersistentVolume
(
"foo"
))
test
.
TestList
(
validNewPersistentVolume
(
"foo"
))
}
}
...
@@ -126,6 +131,7 @@ func TestList(t *testing.T) {
...
@@ -126,6 +131,7 @@ func TestList(t *testing.T) {
func
TestWatch
(
t
*
testing
.
T
)
{
func
TestWatch
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
.
TestWatch
(
test
.
TestWatch
(
validNewPersistentVolume
(
"foo"
),
validNewPersistentVolume
(
"foo"
),
...
@@ -150,6 +156,7 @@ func TestWatch(t *testing.T) {
...
@@ -150,6 +156,7 @@ func TestWatch(t *testing.T) {
func
TestUpdateStatus
(
t
*
testing
.
T
)
{
func
TestUpdateStatus
(
t
*
testing
.
T
)
{
storage
,
statusStorage
,
server
:=
newStorage
(
t
)
storage
,
statusStorage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
ctx
:=
api
.
NewContext
()
ctx
:=
api
.
NewContext
()
key
,
_
:=
storage
.
KeyFunc
(
ctx
,
"foo"
)
key
,
_
:=
storage
.
KeyFunc
(
ctx
,
"foo"
)
key
=
etcdtest
.
AddPrefix
(
key
)
key
=
etcdtest
.
AddPrefix
(
key
)
...
...
pkg/registry/persistentvolumeclaim/etcd/etcd.go
View file @
5b11b598
...
@@ -36,7 +36,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
...
@@ -36,7 +36,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
prefix
:=
"/"
+
opts
.
ResourcePrefix
prefix
:=
"/"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
PersistentVolumeClaimList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
PersistentVolumeClaimList
{}
}
storageInterface
,
_
:=
opts
.
Decorator
(
storageInterface
,
dFunc
:=
opts
.
Decorator
(
opts
.
StorageConfig
,
opts
.
StorageConfig
,
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
PersistentVolumeClaims
),
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
PersistentVolumeClaims
),
&
api
.
PersistentVolumeClaim
{},
&
api
.
PersistentVolumeClaim
{},
...
@@ -67,7 +67,8 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
...
@@ -67,7 +67,8 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
DeleteStrategy
:
persistentvolumeclaim
.
Strategy
,
DeleteStrategy
:
persistentvolumeclaim
.
Strategy
,
ReturnDeletedObject
:
true
,
ReturnDeletedObject
:
true
,
Storage
:
storageInterface
,
Storage
:
storageInterface
,
DestroyFunc
:
dFunc
,
}
}
statusStore
:=
*
store
statusStore
:=
*
store
...
...
pkg/registry/persistentvolumeclaim/etcd/etcd_test.go
View file @
5b11b598
...
@@ -63,6 +63,7 @@ func validNewPersistentVolumeClaim(name, ns string) *api.PersistentVolumeClaim {
...
@@ -63,6 +63,7 @@ func validNewPersistentVolumeClaim(name, ns string) *api.PersistentVolumeClaim {
func
TestCreate
(
t
*
testing
.
T
)
{
func
TestCreate
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
pv
:=
validNewPersistentVolumeClaim
(
"foo"
,
api
.
NamespaceDefault
)
pv
:=
validNewPersistentVolumeClaim
(
"foo"
,
api
.
NamespaceDefault
)
pv
.
ObjectMeta
=
api
.
ObjectMeta
{}
pv
.
ObjectMeta
=
api
.
ObjectMeta
{}
...
@@ -79,6 +80,7 @@ func TestCreate(t *testing.T) {
...
@@ -79,6 +80,7 @@ func TestCreate(t *testing.T) {
func
TestUpdate
(
t
*
testing
.
T
)
{
func
TestUpdate
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestUpdate
(
test
.
TestUpdate
(
// valid
// valid
...
@@ -95,6 +97,7 @@ func TestUpdate(t *testing.T) {
...
@@ -95,6 +97,7 @@ func TestUpdate(t *testing.T) {
func
TestDelete
(
t
*
testing
.
T
)
{
func
TestDelete
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ReturnDeletedObject
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ReturnDeletedObject
()
test
.
TestDelete
(
validNewPersistentVolumeClaim
(
"foo"
,
api
.
NamespaceDefault
))
test
.
TestDelete
(
validNewPersistentVolumeClaim
(
"foo"
,
api
.
NamespaceDefault
))
}
}
...
@@ -102,6 +105,7 @@ func TestDelete(t *testing.T) {
...
@@ -102,6 +105,7 @@ func TestDelete(t *testing.T) {
func
TestGet
(
t
*
testing
.
T
)
{
func
TestGet
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestGet
(
validNewPersistentVolumeClaim
(
"foo"
,
api
.
NamespaceDefault
))
test
.
TestGet
(
validNewPersistentVolumeClaim
(
"foo"
,
api
.
NamespaceDefault
))
}
}
...
@@ -109,6 +113,7 @@ func TestGet(t *testing.T) {
...
@@ -109,6 +113,7 @@ func TestGet(t *testing.T) {
func
TestList
(
t
*
testing
.
T
)
{
func
TestList
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestList
(
validNewPersistentVolumeClaim
(
"foo"
,
api
.
NamespaceDefault
))
test
.
TestList
(
validNewPersistentVolumeClaim
(
"foo"
,
api
.
NamespaceDefault
))
}
}
...
@@ -116,6 +121,7 @@ func TestList(t *testing.T) {
...
@@ -116,6 +121,7 @@ func TestList(t *testing.T) {
func
TestWatch
(
t
*
testing
.
T
)
{
func
TestWatch
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestWatch
(
test
.
TestWatch
(
validNewPersistentVolumeClaim
(
"foo"
,
api
.
NamespaceDefault
),
validNewPersistentVolumeClaim
(
"foo"
,
api
.
NamespaceDefault
),
...
@@ -140,6 +146,7 @@ func TestWatch(t *testing.T) {
...
@@ -140,6 +146,7 @@ func TestWatch(t *testing.T) {
func
TestUpdateStatus
(
t
*
testing
.
T
)
{
func
TestUpdateStatus
(
t
*
testing
.
T
)
{
storage
,
statusStorage
,
server
:=
newStorage
(
t
)
storage
,
statusStorage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
ctx
:=
api
.
NewDefaultContext
()
ctx
:=
api
.
NewDefaultContext
()
key
,
_
:=
storage
.
KeyFunc
(
ctx
,
"foo"
)
key
,
_
:=
storage
.
KeyFunc
(
ctx
,
"foo"
)
...
...
pkg/registry/petset/etcd/etcd.go
View file @
5b11b598
...
@@ -38,7 +38,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
...
@@ -38,7 +38,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
prefix
:=
"/"
+
opts
.
ResourcePrefix
prefix
:=
"/"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
appsapi
.
PetSetList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
appsapi
.
PetSetList
{}
}
storageInterface
,
_
:=
opts
.
Decorator
(
storageInterface
,
dFunc
:=
opts
.
Decorator
(
opts
.
StorageConfig
,
opts
.
StorageConfig
,
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
PetSet
),
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
PetSet
),
&
appsapi
.
PetSet
{},
&
appsapi
.
PetSet
{},
...
@@ -79,7 +79,8 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
...
@@ -79,7 +79,8 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
UpdateStrategy
:
petset
.
Strategy
,
UpdateStrategy
:
petset
.
Strategy
,
DeleteStrategy
:
petset
.
Strategy
,
DeleteStrategy
:
petset
.
Strategy
,
Storage
:
storageInterface
,
Storage
:
storageInterface
,
DestroyFunc
:
dFunc
,
}
}
statusStore
:=
*
store
statusStore
:=
*
store
statusStore
.
UpdateStrategy
=
petset
.
StatusStrategy
statusStore
.
UpdateStrategy
=
petset
.
StatusStrategy
...
...
pkg/registry/petset/etcd/etcd_test.go
View file @
5b11b598
...
@@ -83,6 +83,7 @@ func validNewPetSet() *apps.PetSet {
...
@@ -83,6 +83,7 @@ func validNewPetSet() *apps.PetSet {
func
TestCreate
(
t
*
testing
.
T
)
{
func
TestCreate
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
ps
:=
validNewPetSet
()
ps
:=
validNewPetSet
()
ps
.
ObjectMeta
=
api
.
ObjectMeta
{}
ps
.
ObjectMeta
=
api
.
ObjectMeta
{}
...
@@ -98,7 +99,7 @@ func TestCreate(t *testing.T) {
...
@@ -98,7 +99,7 @@ func TestCreate(t *testing.T) {
func
TestStatusUpdate
(
t
*
testing
.
T
)
{
func
TestStatusUpdate
(
t
*
testing
.
T
)
{
storage
,
statusStorage
,
server
:=
newStorage
(
t
)
storage
,
statusStorage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
ctx
:=
api
.
WithNamespace
(
api
.
NewContext
(),
api
.
NamespaceDefault
)
ctx
:=
api
.
WithNamespace
(
api
.
NewContext
(),
api
.
NamespaceDefault
)
key
:=
etcdtest
.
AddPrefix
(
"/petsets/"
+
api
.
NamespaceDefault
+
"/foo"
)
key
:=
etcdtest
.
AddPrefix
(
"/petsets/"
+
api
.
NamespaceDefault
+
"/foo"
)
validPetSet
:=
validNewPetSet
()
validPetSet
:=
validNewPetSet
()
...
@@ -135,6 +136,7 @@ func TestStatusUpdate(t *testing.T) {
...
@@ -135,6 +136,7 @@ func TestStatusUpdate(t *testing.T) {
func
TestGet
(
t
*
testing
.
T
)
{
func
TestGet
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestGet
(
validNewPetSet
())
test
.
TestGet
(
validNewPetSet
())
}
}
...
@@ -142,6 +144,7 @@ func TestGet(t *testing.T) {
...
@@ -142,6 +144,7 @@ func TestGet(t *testing.T) {
func
TestList
(
t
*
testing
.
T
)
{
func
TestList
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestList
(
validNewPetSet
())
test
.
TestList
(
validNewPetSet
())
}
}
...
@@ -149,6 +152,7 @@ func TestList(t *testing.T) {
...
@@ -149,6 +152,7 @@ func TestList(t *testing.T) {
func
TestDelete
(
t
*
testing
.
T
)
{
func
TestDelete
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestDelete
(
validNewPetSet
())
test
.
TestDelete
(
validNewPetSet
())
}
}
...
@@ -156,6 +160,7 @@ func TestDelete(t *testing.T) {
...
@@ -156,6 +160,7 @@ func TestDelete(t *testing.T) {
func
TestWatch
(
t
*
testing
.
T
)
{
func
TestWatch
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestWatch
(
test
.
TestWatch
(
validNewPetSet
(),
validNewPetSet
(),
...
...
pkg/registry/pod/etcd/etcd.go
View file @
5b11b598
...
@@ -63,7 +63,7 @@ func NewStorage(opts generic.RESTOptions, k client.ConnectionInfoGetter, proxyTr
...
@@ -63,7 +63,7 @@ func NewStorage(opts generic.RESTOptions, k client.ConnectionInfoGetter, proxyTr
prefix
:=
"/"
+
opts
.
ResourcePrefix
prefix
:=
"/"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
PodList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
PodList
{}
}
storageInterface
,
_
:=
opts
.
Decorator
(
storageInterface
,
dFunc
:=
opts
.
Decorator
(
opts
.
StorageConfig
,
opts
.
StorageConfig
,
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
Pods
),
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
Pods
),
&
api
.
Pod
{},
&
api
.
Pod
{},
...
@@ -94,7 +94,8 @@ func NewStorage(opts generic.RESTOptions, k client.ConnectionInfoGetter, proxyTr
...
@@ -94,7 +94,8 @@ func NewStorage(opts generic.RESTOptions, k client.ConnectionInfoGetter, proxyTr
DeleteStrategy
:
pod
.
Strategy
,
DeleteStrategy
:
pod
.
Strategy
,
ReturnDeletedObject
:
true
,
ReturnDeletedObject
:
true
,
Storage
:
storageInterface
,
Storage
:
storageInterface
,
DestroyFunc
:
dFunc
,
}
}
statusStore
:=
*
store
statusStore
:=
*
store
...
...
pkg/registry/pod/etcd/etcd_test.go
View file @
5b11b598
...
@@ -82,6 +82,7 @@ func validChangedPod() *api.Pod {
...
@@ -82,6 +82,7 @@ func validChangedPod() *api.Pod {
func
TestCreate
(
t
*
testing
.
T
)
{
func
TestCreate
(
t
*
testing
.
T
)
{
storage
,
_
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
pod
:=
validNewPod
()
pod
:=
validNewPod
()
pod
.
ObjectMeta
=
api
.
ObjectMeta
{}
pod
.
ObjectMeta
=
api
.
ObjectMeta
{}
...
@@ -108,6 +109,7 @@ func TestCreate(t *testing.T) {
...
@@ -108,6 +109,7 @@ func TestCreate(t *testing.T) {
func
TestUpdate
(
t
*
testing
.
T
)
{
func
TestUpdate
(
t
*
testing
.
T
)
{
storage
,
_
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestUpdate
(
test
.
TestUpdate
(
// valid
// valid
...
@@ -124,6 +126,7 @@ func TestUpdate(t *testing.T) {
...
@@ -124,6 +126,7 @@ func TestUpdate(t *testing.T) {
func
TestDelete
(
t
*
testing
.
T
)
{
func
TestDelete
(
t
*
testing
.
T
)
{
storage
,
_
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ReturnDeletedObject
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ReturnDeletedObject
()
test
.
TestDelete
(
validNewPod
())
test
.
TestDelete
(
validNewPod
())
...
@@ -156,6 +159,7 @@ func TestIgnoreDeleteNotFound(t *testing.T) {
...
@@ -156,6 +159,7 @@ func TestIgnoreDeleteNotFound(t *testing.T) {
called
:=
false
called
:=
false
registry
,
server
:=
newFailDeleteStorage
(
t
,
&
called
)
registry
,
server
:=
newFailDeleteStorage
(
t
,
&
called
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
registry
.
Store
.
DestroyFunc
()
// should fail if pod A is not created yet.
// should fail if pod A is not created yet.
_
,
err
:=
registry
.
Delete
(
testContext
,
pod
.
Name
,
nil
)
_
,
err
:=
registry
.
Delete
(
testContext
,
pod
.
Name
,
nil
)
...
@@ -199,6 +203,7 @@ func TestIgnoreDeleteNotFound(t *testing.T) {
...
@@ -199,6 +203,7 @@ func TestIgnoreDeleteNotFound(t *testing.T) {
func
TestCreateSetsFields
(
t
*
testing
.
T
)
{
func
TestCreateSetsFields
(
t
*
testing
.
T
)
{
storage
,
_
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
pod
:=
validNewPod
()
pod
:=
validNewPod
()
_
,
err
:=
storage
.
Create
(
api
.
NewDefaultContext
(),
pod
)
_
,
err
:=
storage
.
Create
(
api
.
NewDefaultContext
(),
pod
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -341,6 +346,7 @@ func TestResourceLocation(t *testing.T) {
...
@@ -341,6 +346,7 @@ func TestResourceLocation(t *testing.T) {
func
TestGet
(
t
*
testing
.
T
)
{
func
TestGet
(
t
*
testing
.
T
)
{
storage
,
_
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestGet
(
validNewPod
())
test
.
TestGet
(
validNewPod
())
}
}
...
@@ -348,6 +354,7 @@ func TestGet(t *testing.T) {
...
@@ -348,6 +354,7 @@ func TestGet(t *testing.T) {
func
TestList
(
t
*
testing
.
T
)
{
func
TestList
(
t
*
testing
.
T
)
{
storage
,
_
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestList
(
validNewPod
())
test
.
TestList
(
validNewPod
())
}
}
...
@@ -355,6 +362,7 @@ func TestList(t *testing.T) {
...
@@ -355,6 +362,7 @@ func TestList(t *testing.T) {
func
TestWatch
(
t
*
testing
.
T
)
{
func
TestWatch
(
t
*
testing
.
T
)
{
storage
,
_
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestWatch
(
test
.
TestWatch
(
validNewPod
(),
validNewPod
(),
...
@@ -378,6 +386,7 @@ func TestWatch(t *testing.T) {
...
@@ -378,6 +386,7 @@ func TestWatch(t *testing.T) {
func
TestEtcdCreate
(
t
*
testing
.
T
)
{
func
TestEtcdCreate
(
t
*
testing
.
T
)
{
storage
,
bindingStorage
,
_
,
server
:=
newStorage
(
t
)
storage
,
bindingStorage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
ctx
:=
api
.
NewDefaultContext
()
ctx
:=
api
.
NewDefaultContext
()
key
,
_
:=
storage
.
KeyFunc
(
ctx
,
"foo"
)
key
,
_
:=
storage
.
KeyFunc
(
ctx
,
"foo"
)
key
=
etcdtest
.
AddPrefix
(
key
)
key
=
etcdtest
.
AddPrefix
(
key
)
...
@@ -406,6 +415,7 @@ func TestEtcdCreate(t *testing.T) {
...
@@ -406,6 +415,7 @@ func TestEtcdCreate(t *testing.T) {
func
TestEtcdCreateBindingNoPod
(
t
*
testing
.
T
)
{
func
TestEtcdCreateBindingNoPod
(
t
*
testing
.
T
)
{
storage
,
bindingStorage
,
_
,
server
:=
newStorage
(
t
)
storage
,
bindingStorage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
ctx
:=
api
.
NewDefaultContext
()
ctx
:=
api
.
NewDefaultContext
()
key
,
_
:=
storage
.
KeyFunc
(
ctx
,
"foo"
)
key
,
_
:=
storage
.
KeyFunc
(
ctx
,
"foo"
)
...
@@ -437,6 +447,7 @@ func TestEtcdCreateBindingNoPod(t *testing.T) {
...
@@ -437,6 +447,7 @@ func TestEtcdCreateBindingNoPod(t *testing.T) {
func
TestEtcdCreateFailsWithoutNamespace
(
t
*
testing
.
T
)
{
func
TestEtcdCreateFailsWithoutNamespace
(
t
*
testing
.
T
)
{
storage
,
_
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
pod
:=
validNewPod
()
pod
:=
validNewPod
()
pod
.
Namespace
=
""
pod
.
Namespace
=
""
_
,
err
:=
storage
.
Create
(
api
.
NewContext
(),
pod
)
_
,
err
:=
storage
.
Create
(
api
.
NewContext
(),
pod
)
...
@@ -449,6 +460,7 @@ func TestEtcdCreateFailsWithoutNamespace(t *testing.T) {
...
@@ -449,6 +460,7 @@ func TestEtcdCreateFailsWithoutNamespace(t *testing.T) {
func
TestEtcdCreateWithContainersNotFound
(
t
*
testing
.
T
)
{
func
TestEtcdCreateWithContainersNotFound
(
t
*
testing
.
T
)
{
storage
,
bindingStorage
,
_
,
server
:=
newStorage
(
t
)
storage
,
bindingStorage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
ctx
:=
api
.
NewDefaultContext
()
ctx
:=
api
.
NewDefaultContext
()
key
,
_
:=
storage
.
KeyFunc
(
ctx
,
"foo"
)
key
,
_
:=
storage
.
KeyFunc
(
ctx
,
"foo"
)
key
=
etcdtest
.
AddPrefix
(
key
)
key
=
etcdtest
.
AddPrefix
(
key
)
...
@@ -484,6 +496,7 @@ func TestEtcdCreateWithContainersNotFound(t *testing.T) {
...
@@ -484,6 +496,7 @@ func TestEtcdCreateWithContainersNotFound(t *testing.T) {
func
TestEtcdCreateWithConflict
(
t
*
testing
.
T
)
{
func
TestEtcdCreateWithConflict
(
t
*
testing
.
T
)
{
storage
,
bindingStorage
,
_
,
server
:=
newStorage
(
t
)
storage
,
bindingStorage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
ctx
:=
api
.
NewDefaultContext
()
ctx
:=
api
.
NewDefaultContext
()
_
,
err
:=
storage
.
Create
(
ctx
,
validNewPod
())
_
,
err
:=
storage
.
Create
(
ctx
,
validNewPod
())
...
@@ -514,6 +527,7 @@ func TestEtcdCreateWithConflict(t *testing.T) {
...
@@ -514,6 +527,7 @@ func TestEtcdCreateWithConflict(t *testing.T) {
func
TestEtcdCreateWithExistingContainers
(
t
*
testing
.
T
)
{
func
TestEtcdCreateWithExistingContainers
(
t
*
testing
.
T
)
{
storage
,
bindingStorage
,
_
,
server
:=
newStorage
(
t
)
storage
,
bindingStorage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
ctx
:=
api
.
NewDefaultContext
()
ctx
:=
api
.
NewDefaultContext
()
key
,
_
:=
storage
.
KeyFunc
(
ctx
,
"foo"
)
key
,
_
:=
storage
.
KeyFunc
(
ctx
,
"foo"
)
key
=
etcdtest
.
AddPrefix
(
key
)
key
=
etcdtest
.
AddPrefix
(
key
)
...
@@ -592,6 +606,7 @@ func TestEtcdCreateBinding(t *testing.T) {
...
@@ -592,6 +606,7 @@ func TestEtcdCreateBinding(t *testing.T) {
t
.
Errorf
(
"%s: expected: %v, got: %v"
,
k
,
pod
.
(
*
api
.
Pod
)
.
Spec
.
NodeName
,
test
.
binding
.
Target
.
Name
)
t
.
Errorf
(
"%s: expected: %v, got: %v"
,
k
,
pod
.
(
*
api
.
Pod
)
.
Spec
.
NodeName
,
test
.
binding
.
Target
.
Name
)
}
}
}
}
storage
.
Store
.
DestroyFunc
()
server
.
Terminate
(
t
)
server
.
Terminate
(
t
)
}
}
}
}
...
@@ -599,6 +614,7 @@ func TestEtcdCreateBinding(t *testing.T) {
...
@@ -599,6 +614,7 @@ func TestEtcdCreateBinding(t *testing.T) {
func
TestEtcdUpdateNotScheduled
(
t
*
testing
.
T
)
{
func
TestEtcdUpdateNotScheduled
(
t
*
testing
.
T
)
{
storage
,
_
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
ctx
:=
api
.
NewDefaultContext
()
ctx
:=
api
.
NewDefaultContext
()
key
,
_
:=
storage
.
KeyFunc
(
ctx
,
"foo"
)
key
,
_
:=
storage
.
KeyFunc
(
ctx
,
"foo"
)
...
@@ -626,6 +642,7 @@ func TestEtcdUpdateNotScheduled(t *testing.T) {
...
@@ -626,6 +642,7 @@ func TestEtcdUpdateNotScheduled(t *testing.T) {
func
TestEtcdUpdateScheduled
(
t
*
testing
.
T
)
{
func
TestEtcdUpdateScheduled
(
t
*
testing
.
T
)
{
storage
,
_
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
ctx
:=
api
.
NewDefaultContext
()
ctx
:=
api
.
NewDefaultContext
()
key
,
_
:=
storage
.
KeyFunc
(
ctx
,
"foo"
)
key
,
_
:=
storage
.
KeyFunc
(
ctx
,
"foo"
)
...
@@ -695,6 +712,7 @@ func TestEtcdUpdateScheduled(t *testing.T) {
...
@@ -695,6 +712,7 @@ func TestEtcdUpdateScheduled(t *testing.T) {
func
TestEtcdUpdateStatus
(
t
*
testing
.
T
)
{
func
TestEtcdUpdateStatus
(
t
*
testing
.
T
)
{
storage
,
_
,
statusStorage
,
server
:=
newStorage
(
t
)
storage
,
_
,
statusStorage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
ctx
:=
api
.
NewDefaultContext
()
ctx
:=
api
.
NewDefaultContext
()
key
,
_
:=
storage
.
KeyFunc
(
ctx
,
"foo"
)
key
,
_
:=
storage
.
KeyFunc
(
ctx
,
"foo"
)
...
...
pkg/registry/poddisruptionbudget/etcd/etcd.go
View file @
5b11b598
...
@@ -38,7 +38,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
...
@@ -38,7 +38,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
prefix
:=
"/"
+
opts
.
ResourcePrefix
prefix
:=
"/"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
policyapi
.
PodDisruptionBudgetList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
policyapi
.
PodDisruptionBudgetList
{}
}
storageInterface
,
_
:=
opts
.
Decorator
(
storageInterface
,
dFunc
:=
opts
.
Decorator
(
opts
.
StorageConfig
,
opts
.
StorageConfig
,
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
PodDisruptionBudget
),
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
PodDisruptionBudget
),
&
policyapi
.
PodDisruptionBudget
{},
&
policyapi
.
PodDisruptionBudget
{},
...
@@ -79,7 +79,8 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
...
@@ -79,7 +79,8 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
UpdateStrategy
:
poddisruptionbudget
.
Strategy
,
UpdateStrategy
:
poddisruptionbudget
.
Strategy
,
DeleteStrategy
:
poddisruptionbudget
.
Strategy
,
DeleteStrategy
:
poddisruptionbudget
.
Strategy
,
Storage
:
storageInterface
,
Storage
:
storageInterface
,
DestroyFunc
:
dFunc
,
}
}
statusStore
:=
*
store
statusStore
:=
*
store
statusStore
.
UpdateStrategy
=
poddisruptionbudget
.
StatusStrategy
statusStore
.
UpdateStrategy
=
poddisruptionbudget
.
StatusStrategy
...
...
pkg/registry/poddisruptionbudget/etcd/etcd_test.go
View file @
5b11b598
...
@@ -68,6 +68,7 @@ func validNewPodDisruptionBudget() *policy.PodDisruptionBudget {
...
@@ -68,6 +68,7 @@ func validNewPodDisruptionBudget() *policy.PodDisruptionBudget {
func
TestCreate
(
t
*
testing
.
T
)
{
func
TestCreate
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
pdb
:=
validNewPodDisruptionBudget
()
pdb
:=
validNewPodDisruptionBudget
()
pdb
.
ObjectMeta
=
api
.
ObjectMeta
{}
pdb
.
ObjectMeta
=
api
.
ObjectMeta
{}
...
@@ -83,7 +84,7 @@ func TestCreate(t *testing.T) {
...
@@ -83,7 +84,7 @@ func TestCreate(t *testing.T) {
func
TestStatusUpdate
(
t
*
testing
.
T
)
{
func
TestStatusUpdate
(
t
*
testing
.
T
)
{
storage
,
statusStorage
,
server
:=
newStorage
(
t
)
storage
,
statusStorage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
ctx
:=
api
.
WithNamespace
(
api
.
NewContext
(),
api
.
NamespaceDefault
)
ctx
:=
api
.
WithNamespace
(
api
.
NewContext
(),
api
.
NamespaceDefault
)
key
:=
etcdtest
.
AddPrefix
(
"/poddisruptionbudgets/"
+
api
.
NamespaceDefault
+
"/foo"
)
key
:=
etcdtest
.
AddPrefix
(
"/poddisruptionbudgets/"
+
api
.
NamespaceDefault
+
"/foo"
)
validPodDisruptionBudget
:=
validNewPodDisruptionBudget
()
validPodDisruptionBudget
:=
validNewPodDisruptionBudget
()
...
@@ -120,6 +121,7 @@ func TestStatusUpdate(t *testing.T) {
...
@@ -120,6 +121,7 @@ func TestStatusUpdate(t *testing.T) {
func
TestGet
(
t
*
testing
.
T
)
{
func
TestGet
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestGet
(
validNewPodDisruptionBudget
())
test
.
TestGet
(
validNewPodDisruptionBudget
())
}
}
...
@@ -127,6 +129,7 @@ func TestGet(t *testing.T) {
...
@@ -127,6 +129,7 @@ func TestGet(t *testing.T) {
func
TestList
(
t
*
testing
.
T
)
{
func
TestList
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestList
(
validNewPodDisruptionBudget
())
test
.
TestList
(
validNewPodDisruptionBudget
())
}
}
...
@@ -134,6 +137,7 @@ func TestList(t *testing.T) {
...
@@ -134,6 +137,7 @@ func TestList(t *testing.T) {
func
TestDelete
(
t
*
testing
.
T
)
{
func
TestDelete
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestDelete
(
validNewPodDisruptionBudget
())
test
.
TestDelete
(
validNewPodDisruptionBudget
())
}
}
...
@@ -141,6 +145,7 @@ func TestDelete(t *testing.T) {
...
@@ -141,6 +145,7 @@ func TestDelete(t *testing.T) {
func
TestWatch
(
t
*
testing
.
T
)
{
func
TestWatch
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestWatch
(
test
.
TestWatch
(
validNewPodDisruptionBudget
(),
validNewPodDisruptionBudget
(),
...
...
pkg/registry/podsecuritypolicy/etcd/etcd.go
View file @
5b11b598
...
@@ -37,7 +37,7 @@ func NewREST(opts generic.RESTOptions) *REST {
...
@@ -37,7 +37,7 @@ func NewREST(opts generic.RESTOptions) *REST {
prefix
:=
"/"
+
opts
.
ResourcePrefix
prefix
:=
"/"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
extensions
.
PodSecurityPolicyList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
extensions
.
PodSecurityPolicyList
{}
}
storageInterface
,
_
:=
opts
.
Decorator
(
storageInterface
,
dFunc
:=
opts
.
Decorator
(
opts
.
StorageConfig
,
opts
.
StorageConfig
,
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
PodSecurityPolicies
),
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
PodSecurityPolicies
),
&
extensions
.
PodSecurityPolicy
{},
&
extensions
.
PodSecurityPolicy
{},
...
@@ -68,6 +68,7 @@ func NewREST(opts generic.RESTOptions) *REST {
...
@@ -68,6 +68,7 @@ func NewREST(opts generic.RESTOptions) *REST {
DeleteStrategy
:
podsecuritypolicy
.
Strategy
,
DeleteStrategy
:
podsecuritypolicy
.
Strategy
,
ReturnDeletedObject
:
true
,
ReturnDeletedObject
:
true
,
Storage
:
storageInterface
,
Storage
:
storageInterface
,
DestroyFunc
:
dFunc
,
}
}
return
&
REST
{
store
}
return
&
REST
{
store
}
}
}
pkg/registry/podsecuritypolicy/etcd/etcd_test.go
View file @
5b11b598
...
@@ -62,6 +62,7 @@ func validNewPodSecurityPolicy() *extensions.PodSecurityPolicy {
...
@@ -62,6 +62,7 @@ func validNewPodSecurityPolicy() *extensions.PodSecurityPolicy {
func
TestCreate
(
t
*
testing
.
T
)
{
func
TestCreate
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
psp
:=
validNewPodSecurityPolicy
()
psp
:=
validNewPodSecurityPolicy
()
psp
.
ObjectMeta
=
api
.
ObjectMeta
{
GenerateName
:
"foo-"
}
psp
.
ObjectMeta
=
api
.
ObjectMeta
{
GenerateName
:
"foo-"
}
...
@@ -78,6 +79,7 @@ func TestCreate(t *testing.T) {
...
@@ -78,6 +79,7 @@ func TestCreate(t *testing.T) {
func
TestUpdate
(
t
*
testing
.
T
)
{
func
TestUpdate
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
.
TestUpdate
(
test
.
TestUpdate
(
// valid
// valid
...
@@ -94,6 +96,7 @@ func TestUpdate(t *testing.T) {
...
@@ -94,6 +96,7 @@ func TestUpdate(t *testing.T) {
func
TestDelete
(
t
*
testing
.
T
)
{
func
TestDelete
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
.
ReturnDeletedObject
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
.
ReturnDeletedObject
()
test
.
TestDelete
(
validNewPodSecurityPolicy
())
test
.
TestDelete
(
validNewPodSecurityPolicy
())
}
}
...
@@ -101,6 +104,7 @@ func TestDelete(t *testing.T) {
...
@@ -101,6 +104,7 @@ func TestDelete(t *testing.T) {
func
TestGet
(
t
*
testing
.
T
)
{
func
TestGet
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
.
TestGet
(
validNewPodSecurityPolicy
())
test
.
TestGet
(
validNewPodSecurityPolicy
())
}
}
...
@@ -108,6 +112,7 @@ func TestGet(t *testing.T) {
...
@@ -108,6 +112,7 @@ func TestGet(t *testing.T) {
func
TestList
(
t
*
testing
.
T
)
{
func
TestList
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
.
TestList
(
validNewPodSecurityPolicy
())
test
.
TestList
(
validNewPodSecurityPolicy
())
}
}
...
@@ -115,6 +120,7 @@ func TestList(t *testing.T) {
...
@@ -115,6 +120,7 @@ func TestList(t *testing.T) {
func
TestWatch
(
t
*
testing
.
T
)
{
func
TestWatch
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
.
TestWatch
(
test
.
TestWatch
(
validNewPodSecurityPolicy
(),
validNewPodSecurityPolicy
(),
...
...
pkg/registry/podtemplate/etcd/etcd.go
View file @
5b11b598
...
@@ -35,7 +35,7 @@ func NewREST(opts generic.RESTOptions) *REST {
...
@@ -35,7 +35,7 @@ func NewREST(opts generic.RESTOptions) *REST {
prefix
:=
"/"
+
opts
.
ResourcePrefix
prefix
:=
"/"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
PodTemplateList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
PodTemplateList
{}
}
storageInterface
,
_
:=
opts
.
Decorator
(
storageInterface
,
dFunc
:=
opts
.
Decorator
(
opts
.
StorageConfig
,
opts
.
StorageConfig
,
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
PodTemplates
),
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
PodTemplates
),
&
api
.
PodTemplate
{},
&
api
.
PodTemplate
{},
...
@@ -68,7 +68,8 @@ func NewREST(opts generic.RESTOptions) *REST {
...
@@ -68,7 +68,8 @@ func NewREST(opts generic.RESTOptions) *REST {
ReturnDeletedObject
:
true
,
ReturnDeletedObject
:
true
,
Storage
:
storageInterface
,
Storage
:
storageInterface
,
DestroyFunc
:
dFunc
,
}
}
return
&
REST
{
store
}
return
&
REST
{
store
}
}
}
pkg/registry/podtemplate/etcd/etcd_test.go
View file @
5b11b598
...
@@ -64,6 +64,7 @@ func validNewPodTemplate(name string) *api.PodTemplate {
...
@@ -64,6 +64,7 @@ func validNewPodTemplate(name string) *api.PodTemplate {
func
TestCreate
(
t
*
testing
.
T
)
{
func
TestCreate
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
pod
:=
validNewPodTemplate
(
"foo"
)
pod
:=
validNewPodTemplate
(
"foo"
)
pod
.
ObjectMeta
=
api
.
ObjectMeta
{}
pod
.
ObjectMeta
=
api
.
ObjectMeta
{}
...
@@ -80,6 +81,7 @@ func TestCreate(t *testing.T) {
...
@@ -80,6 +81,7 @@ func TestCreate(t *testing.T) {
func
TestUpdate
(
t
*
testing
.
T
)
{
func
TestUpdate
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestUpdate
(
test
.
TestUpdate
(
//valid
//valid
...
@@ -96,6 +98,7 @@ func TestUpdate(t *testing.T) {
...
@@ -96,6 +98,7 @@ func TestUpdate(t *testing.T) {
func
TestDelete
(
t
*
testing
.
T
)
{
func
TestDelete
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ReturnDeletedObject
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ReturnDeletedObject
()
test
.
TestDelete
(
validNewPodTemplate
(
"foo"
))
test
.
TestDelete
(
validNewPodTemplate
(
"foo"
))
}
}
...
@@ -103,6 +106,7 @@ func TestDelete(t *testing.T) {
...
@@ -103,6 +106,7 @@ func TestDelete(t *testing.T) {
func
TestGet
(
t
*
testing
.
T
)
{
func
TestGet
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestGet
(
validNewPodTemplate
(
"foo"
))
test
.
TestGet
(
validNewPodTemplate
(
"foo"
))
}
}
...
@@ -110,6 +114,7 @@ func TestGet(t *testing.T) {
...
@@ -110,6 +114,7 @@ func TestGet(t *testing.T) {
func
TestList
(
t
*
testing
.
T
)
{
func
TestList
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestList
(
validNewPodTemplate
(
"foo"
))
test
.
TestList
(
validNewPodTemplate
(
"foo"
))
}
}
...
@@ -117,6 +122,7 @@ func TestList(t *testing.T) {
...
@@ -117,6 +122,7 @@ func TestList(t *testing.T) {
func
TestWatch
(
t
*
testing
.
T
)
{
func
TestWatch
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestWatch
(
test
.
TestWatch
(
validNewPodTemplate
(
"foo"
),
validNewPodTemplate
(
"foo"
),
...
...
pkg/registry/replicaset/etcd/etcd.go
View file @
5b11b598
...
@@ -61,7 +61,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
...
@@ -61,7 +61,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
prefix
:=
"/"
+
opts
.
ResourcePrefix
prefix
:=
"/"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
extensions
.
ReplicaSetList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
extensions
.
ReplicaSetList
{}
}
storageInterface
,
_
:=
opts
.
Decorator
(
storageInterface
,
dFunc
:=
opts
.
Decorator
(
opts
.
StorageConfig
,
opts
.
StorageConfig
,
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
Replicasets
),
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
Replicasets
),
&
extensions
.
ReplicaSet
{},
&
extensions
.
ReplicaSet
{},
...
@@ -102,7 +102,8 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
...
@@ -102,7 +102,8 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
UpdateStrategy
:
replicaset
.
Strategy
,
UpdateStrategy
:
replicaset
.
Strategy
,
DeleteStrategy
:
replicaset
.
Strategy
,
DeleteStrategy
:
replicaset
.
Strategy
,
Storage
:
storageInterface
,
Storage
:
storageInterface
,
DestroyFunc
:
dFunc
,
}
}
statusStore
:=
*
store
statusStore
:=
*
store
statusStore
.
UpdateStrategy
=
replicaset
.
StatusStrategy
statusStore
.
UpdateStrategy
=
replicaset
.
StatusStrategy
...
...
pkg/registry/replicaset/etcd/etcd_test.go
View file @
5b11b598
...
@@ -91,6 +91,7 @@ var validReplicaSet = *validNewReplicaSet()
...
@@ -91,6 +91,7 @@ var validReplicaSet = *validNewReplicaSet()
func
TestCreate
(
t
*
testing
.
T
)
{
func
TestCreate
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
ReplicaSet
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
ReplicaSet
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
ReplicaSet
.
Store
)
rs
:=
validNewReplicaSet
()
rs
:=
validNewReplicaSet
()
rs
.
ObjectMeta
=
api
.
ObjectMeta
{}
rs
.
ObjectMeta
=
api
.
ObjectMeta
{}
...
@@ -111,6 +112,7 @@ func TestCreate(t *testing.T) {
...
@@ -111,6 +112,7 @@ func TestCreate(t *testing.T) {
func
TestUpdate
(
t
*
testing
.
T
)
{
func
TestUpdate
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
ReplicaSet
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
ReplicaSet
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
ReplicaSet
.
Store
)
test
.
TestUpdate
(
test
.
TestUpdate
(
// valid
// valid
...
@@ -138,6 +140,7 @@ func TestUpdate(t *testing.T) {
...
@@ -138,6 +140,7 @@ func TestUpdate(t *testing.T) {
func
TestDelete
(
t
*
testing
.
T
)
{
func
TestDelete
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
ReplicaSet
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
ReplicaSet
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
ReplicaSet
.
Store
)
test
.
TestDelete
(
validNewReplicaSet
())
test
.
TestDelete
(
validNewReplicaSet
())
}
}
...
@@ -145,6 +148,7 @@ func TestDelete(t *testing.T) {
...
@@ -145,6 +148,7 @@ func TestDelete(t *testing.T) {
func
TestGenerationNumber
(
t
*
testing
.
T
)
{
func
TestGenerationNumber
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
ReplicaSet
.
Store
.
DestroyFunc
()
modifiedSno
:=
*
validNewReplicaSet
()
modifiedSno
:=
*
validNewReplicaSet
()
modifiedSno
.
Generation
=
100
modifiedSno
.
Generation
=
100
modifiedSno
.
Status
.
ObservedGeneration
=
10
modifiedSno
.
Status
.
ObservedGeneration
=
10
...
@@ -195,6 +199,7 @@ func TestGenerationNumber(t *testing.T) {
...
@@ -195,6 +199,7 @@ func TestGenerationNumber(t *testing.T) {
func
TestGet
(
t
*
testing
.
T
)
{
func
TestGet
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
ReplicaSet
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
ReplicaSet
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
ReplicaSet
.
Store
)
test
.
TestGet
(
validNewReplicaSet
())
test
.
TestGet
(
validNewReplicaSet
())
}
}
...
@@ -202,6 +207,7 @@ func TestGet(t *testing.T) {
...
@@ -202,6 +207,7 @@ func TestGet(t *testing.T) {
func
TestList
(
t
*
testing
.
T
)
{
func
TestList
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
ReplicaSet
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
ReplicaSet
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
ReplicaSet
.
Store
)
test
.
TestList
(
validNewReplicaSet
())
test
.
TestList
(
validNewReplicaSet
())
}
}
...
@@ -209,6 +215,7 @@ func TestList(t *testing.T) {
...
@@ -209,6 +215,7 @@ func TestList(t *testing.T) {
func
TestWatch
(
t
*
testing
.
T
)
{
func
TestWatch
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
ReplicaSet
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
ReplicaSet
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
ReplicaSet
.
Store
)
test
.
TestWatch
(
test
.
TestWatch
(
validNewReplicaSet
(),
validNewReplicaSet
(),
...
@@ -241,6 +248,7 @@ func TestWatch(t *testing.T) {
...
@@ -241,6 +248,7 @@ func TestWatch(t *testing.T) {
func
TestScaleGet
(
t
*
testing
.
T
)
{
func
TestScaleGet
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
ReplicaSet
.
Store
.
DestroyFunc
()
name
:=
"foo"
name
:=
"foo"
...
@@ -280,6 +288,7 @@ func TestScaleGet(t *testing.T) {
...
@@ -280,6 +288,7 @@ func TestScaleGet(t *testing.T) {
func
TestScaleUpdate
(
t
*
testing
.
T
)
{
func
TestScaleUpdate
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
ReplicaSet
.
Store
.
DestroyFunc
()
name
:=
"foo"
name
:=
"foo"
...
@@ -324,6 +333,7 @@ func TestScaleUpdate(t *testing.T) {
...
@@ -324,6 +333,7 @@ func TestScaleUpdate(t *testing.T) {
func
TestStatusUpdate
(
t
*
testing
.
T
)
{
func
TestStatusUpdate
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
ReplicaSet
.
Store
.
DestroyFunc
()
ctx
:=
api
.
WithNamespace
(
api
.
NewContext
(),
api
.
NamespaceDefault
)
ctx
:=
api
.
WithNamespace
(
api
.
NewContext
(),
api
.
NamespaceDefault
)
key
:=
etcdtest
.
AddPrefix
(
"/replicasets/"
+
api
.
NamespaceDefault
+
"/foo"
)
key
:=
etcdtest
.
AddPrefix
(
"/replicasets/"
+
api
.
NamespaceDefault
+
"/foo"
)
...
...
pkg/registry/resourcequota/etcd/etcd.go
View file @
5b11b598
...
@@ -36,7 +36,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
...
@@ -36,7 +36,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
prefix
:=
"/"
+
opts
.
ResourcePrefix
prefix
:=
"/"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
ResourceQuotaList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
ResourceQuotaList
{}
}
storageInterface
,
_
:=
opts
.
Decorator
(
storageInterface
,
dFunc
:=
opts
.
Decorator
(
opts
.
StorageConfig
,
opts
.
StorageConfig
,
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
ResourceQuotas
),
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
ResourceQuotas
),
&
api
.
ResourceQuota
{},
&
api
.
ResourceQuota
{},
...
@@ -67,7 +67,8 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
...
@@ -67,7 +67,8 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
DeleteStrategy
:
resourcequota
.
Strategy
,
DeleteStrategy
:
resourcequota
.
Strategy
,
ReturnDeletedObject
:
true
,
ReturnDeletedObject
:
true
,
Storage
:
storageInterface
,
Storage
:
storageInterface
,
DestroyFunc
:
dFunc
,
}
}
statusStore
:=
*
store
statusStore
:=
*
store
...
...
pkg/registry/resourcequota/etcd/etcd_test.go
View file @
5b11b598
...
@@ -60,6 +60,7 @@ func validNewResourceQuota() *api.ResourceQuota {
...
@@ -60,6 +60,7 @@ func validNewResourceQuota() *api.ResourceQuota {
func
TestCreate
(
t
*
testing
.
T
)
{
func
TestCreate
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
resourcequota
:=
validNewResourceQuota
()
resourcequota
:=
validNewResourceQuota
()
resourcequota
.
ObjectMeta
=
api
.
ObjectMeta
{}
resourcequota
.
ObjectMeta
=
api
.
ObjectMeta
{}
...
@@ -76,6 +77,7 @@ func TestCreate(t *testing.T) {
...
@@ -76,6 +77,7 @@ func TestCreate(t *testing.T) {
func
TestCreateSetsFields
(
t
*
testing
.
T
)
{
func
TestCreateSetsFields
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
ctx
:=
api
.
NewDefaultContext
()
ctx
:=
api
.
NewDefaultContext
()
resourcequota
:=
validNewResourceQuota
()
resourcequota
:=
validNewResourceQuota
()
_
,
err
:=
storage
.
Create
(
api
.
NewDefaultContext
(),
resourcequota
)
_
,
err
:=
storage
.
Create
(
api
.
NewDefaultContext
(),
resourcequota
)
...
@@ -99,6 +101,7 @@ func TestCreateSetsFields(t *testing.T) {
...
@@ -99,6 +101,7 @@ func TestCreateSetsFields(t *testing.T) {
func
TestDelete
(
t
*
testing
.
T
)
{
func
TestDelete
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ReturnDeletedObject
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ReturnDeletedObject
()
test
.
TestDelete
(
validNewResourceQuota
())
test
.
TestDelete
(
validNewResourceQuota
())
}
}
...
@@ -106,6 +109,7 @@ func TestDelete(t *testing.T) {
...
@@ -106,6 +109,7 @@ func TestDelete(t *testing.T) {
func
TestGet
(
t
*
testing
.
T
)
{
func
TestGet
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestGet
(
validNewResourceQuota
())
test
.
TestGet
(
validNewResourceQuota
())
}
}
...
@@ -113,6 +117,7 @@ func TestGet(t *testing.T) {
...
@@ -113,6 +117,7 @@ func TestGet(t *testing.T) {
func
TestList
(
t
*
testing
.
T
)
{
func
TestList
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestList
(
validNewResourceQuota
())
test
.
TestList
(
validNewResourceQuota
())
}
}
...
@@ -120,6 +125,7 @@ func TestList(t *testing.T) {
...
@@ -120,6 +125,7 @@ func TestList(t *testing.T) {
func
TestWatch
(
t
*
testing
.
T
)
{
func
TestWatch
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestWatch
(
test
.
TestWatch
(
validNewResourceQuota
(),
validNewResourceQuota
(),
...
@@ -143,6 +149,7 @@ func TestWatch(t *testing.T) {
...
@@ -143,6 +149,7 @@ func TestWatch(t *testing.T) {
func
TestUpdateStatus
(
t
*
testing
.
T
)
{
func
TestUpdateStatus
(
t
*
testing
.
T
)
{
storage
,
status
,
server
:=
newStorage
(
t
)
storage
,
status
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
ctx
:=
api
.
NewDefaultContext
()
ctx
:=
api
.
NewDefaultContext
()
key
,
_
:=
storage
.
KeyFunc
(
ctx
,
"foo"
)
key
,
_
:=
storage
.
KeyFunc
(
ctx
,
"foo"
)
...
...
pkg/registry/role/etcd/etcd.go
View file @
5b11b598
...
@@ -37,7 +37,7 @@ func NewREST(opts generic.RESTOptions) *REST {
...
@@ -37,7 +37,7 @@ func NewREST(opts generic.RESTOptions) *REST {
prefix
:=
"/"
+
opts
.
ResourcePrefix
prefix
:=
"/"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
rbac
.
RoleList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
rbac
.
RoleList
{}
}
storageInterface
,
_
:=
opts
.
Decorator
(
storageInterface
,
dFunc
:=
opts
.
Decorator
(
opts
.
StorageConfig
,
opts
.
StorageConfig
,
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
Roles
),
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
Roles
),
&
rbac
.
Role
{},
&
rbac
.
Role
{},
...
@@ -67,7 +67,8 @@ func NewREST(opts generic.RESTOptions) *REST {
...
@@ -67,7 +67,8 @@ func NewREST(opts generic.RESTOptions) *REST {
UpdateStrategy
:
role
.
Strategy
,
UpdateStrategy
:
role
.
Strategy
,
DeleteStrategy
:
role
.
Strategy
,
DeleteStrategy
:
role
.
Strategy
,
Storage
:
storageInterface
,
Storage
:
storageInterface
,
DestroyFunc
:
dFunc
,
}
}
return
&
REST
{
store
}
return
&
REST
{
store
}
...
...
pkg/registry/rolebinding/etcd/etcd.go
View file @
5b11b598
...
@@ -37,7 +37,7 @@ func NewREST(opts generic.RESTOptions) *REST {
...
@@ -37,7 +37,7 @@ func NewREST(opts generic.RESTOptions) *REST {
prefix
:=
"/"
+
opts
.
ResourcePrefix
prefix
:=
"/"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
rbac
.
RoleBindingList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
rbac
.
RoleBindingList
{}
}
storageInterface
,
_
:=
opts
.
Decorator
(
storageInterface
,
dFunc
:=
opts
.
Decorator
(
opts
.
StorageConfig
,
opts
.
StorageConfig
,
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
RoleBindings
),
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
RoleBindings
),
&
rbac
.
RoleBinding
{},
&
rbac
.
RoleBinding
{},
...
@@ -67,7 +67,8 @@ func NewREST(opts generic.RESTOptions) *REST {
...
@@ -67,7 +67,8 @@ func NewREST(opts generic.RESTOptions) *REST {
UpdateStrategy
:
rolebinding
.
Strategy
,
UpdateStrategy
:
rolebinding
.
Strategy
,
DeleteStrategy
:
rolebinding
.
Strategy
,
DeleteStrategy
:
rolebinding
.
Strategy
,
Storage
:
storageInterface
,
Storage
:
storageInterface
,
DestroyFunc
:
dFunc
,
}
}
return
&
REST
{
store
}
return
&
REST
{
store
}
...
...
pkg/registry/scheduledjob/etcd/etcd.go
View file @
5b11b598
...
@@ -38,7 +38,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
...
@@ -38,7 +38,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
prefix
:=
"/"
+
opts
.
ResourcePrefix
prefix
:=
"/"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
batch
.
ScheduledJobList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
batch
.
ScheduledJobList
{}
}
storageInterface
,
_
:=
opts
.
Decorator
(
storageInterface
,
dFunc
:=
opts
.
Decorator
(
opts
.
StorageConfig
,
opts
.
StorageConfig
,
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
ScheduledJobs
),
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
ScheduledJobs
),
&
batch
.
ScheduledJob
{},
&
batch
.
ScheduledJob
{},
...
@@ -79,7 +79,8 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
...
@@ -79,7 +79,8 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
UpdateStrategy
:
scheduledjob
.
Strategy
,
UpdateStrategy
:
scheduledjob
.
Strategy
,
DeleteStrategy
:
scheduledjob
.
Strategy
,
DeleteStrategy
:
scheduledjob
.
Strategy
,
Storage
:
storageInterface
,
Storage
:
storageInterface
,
DestroyFunc
:
dFunc
,
}
}
statusStore
:=
*
store
statusStore
:=
*
store
...
...
pkg/registry/scheduledjob/etcd/etcd_test.go
View file @
5b11b598
...
@@ -70,6 +70,7 @@ func TestCreate(t *testing.T) {
...
@@ -70,6 +70,7 @@ func TestCreate(t *testing.T) {
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
validScheduledJob
:=
validNewScheduledJob
()
validScheduledJob
:=
validNewScheduledJob
()
validScheduledJob
.
ObjectMeta
=
api
.
ObjectMeta
{}
validScheduledJob
.
ObjectMeta
=
api
.
ObjectMeta
{}
...
@@ -91,6 +92,7 @@ func TestUpdate(t *testing.T) {
...
@@ -91,6 +92,7 @@ func TestUpdate(t *testing.T) {
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
schedule
:=
"1 1 1 1 ?"
schedule
:=
"1 1 1 1 ?"
test
.
TestUpdate
(
test
.
TestUpdate
(
...
@@ -119,6 +121,7 @@ func TestDelete(t *testing.T) {
...
@@ -119,6 +121,7 @@ func TestDelete(t *testing.T) {
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestDelete
(
validNewScheduledJob
())
test
.
TestDelete
(
validNewScheduledJob
())
}
}
...
@@ -131,6 +134,7 @@ func TestGet(t *testing.T) {
...
@@ -131,6 +134,7 @@ func TestGet(t *testing.T) {
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestGet
(
validNewScheduledJob
())
test
.
TestGet
(
validNewScheduledJob
())
}
}
...
@@ -143,6 +147,7 @@ func TestList(t *testing.T) {
...
@@ -143,6 +147,7 @@ func TestList(t *testing.T) {
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestList
(
validNewScheduledJob
())
test
.
TestList
(
validNewScheduledJob
())
}
}
...
@@ -155,6 +160,7 @@ func TestWatch(t *testing.T) {
...
@@ -155,6 +160,7 @@ func TestWatch(t *testing.T) {
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestWatch
(
test
.
TestWatch
(
validNewScheduledJob
(),
validNewScheduledJob
(),
...
...
pkg/registry/secret/etcd/etcd.go
View file @
5b11b598
...
@@ -35,7 +35,7 @@ func NewREST(opts generic.RESTOptions) *REST {
...
@@ -35,7 +35,7 @@ func NewREST(opts generic.RESTOptions) *REST {
prefix
:=
"/"
+
opts
.
ResourcePrefix
prefix
:=
"/"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
SecretList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
SecretList
{}
}
storageInterface
,
_
:=
opts
.
Decorator
(
storageInterface
,
dFunc
:=
opts
.
Decorator
(
opts
.
StorageConfig
,
opts
.
StorageConfig
,
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
Secrets
),
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
Secrets
),
&
api
.
Secret
{},
&
api
.
Secret
{},
...
@@ -65,7 +65,8 @@ func NewREST(opts generic.RESTOptions) *REST {
...
@@ -65,7 +65,8 @@ func NewREST(opts generic.RESTOptions) *REST {
UpdateStrategy
:
secret
.
Strategy
,
UpdateStrategy
:
secret
.
Strategy
,
DeleteStrategy
:
secret
.
Strategy
,
DeleteStrategy
:
secret
.
Strategy
,
Storage
:
storageInterface
,
Storage
:
storageInterface
,
DestroyFunc
:
dFunc
,
}
}
return
&
REST
{
store
}
return
&
REST
{
store
}
}
}
pkg/registry/secret/etcd/etcd_test.go
View file @
5b11b598
...
@@ -49,6 +49,7 @@ func validNewSecret(name string) *api.Secret {
...
@@ -49,6 +49,7 @@ func validNewSecret(name string) *api.Secret {
func
TestCreate
(
t
*
testing
.
T
)
{
func
TestCreate
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
secret
:=
validNewSecret
(
"foo"
)
secret
:=
validNewSecret
(
"foo"
)
secret
.
ObjectMeta
=
api
.
ObjectMeta
{
GenerateName
:
"foo-"
}
secret
.
ObjectMeta
=
api
.
ObjectMeta
{
GenerateName
:
"foo-"
}
...
@@ -71,6 +72,7 @@ func TestCreate(t *testing.T) {
...
@@ -71,6 +72,7 @@ func TestCreate(t *testing.T) {
func
TestUpdate
(
t
*
testing
.
T
)
{
func
TestUpdate
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestUpdate
(
test
.
TestUpdate
(
// valid
// valid
...
@@ -87,6 +89,7 @@ func TestUpdate(t *testing.T) {
...
@@ -87,6 +89,7 @@ func TestUpdate(t *testing.T) {
func
TestDelete
(
t
*
testing
.
T
)
{
func
TestDelete
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestDelete
(
validNewSecret
(
"foo"
))
test
.
TestDelete
(
validNewSecret
(
"foo"
))
}
}
...
@@ -94,6 +97,7 @@ func TestDelete(t *testing.T) {
...
@@ -94,6 +97,7 @@ func TestDelete(t *testing.T) {
func
TestGet
(
t
*
testing
.
T
)
{
func
TestGet
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestGet
(
validNewSecret
(
"foo"
))
test
.
TestGet
(
validNewSecret
(
"foo"
))
}
}
...
@@ -101,6 +105,7 @@ func TestGet(t *testing.T) {
...
@@ -101,6 +105,7 @@ func TestGet(t *testing.T) {
func
TestList
(
t
*
testing
.
T
)
{
func
TestList
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestList
(
validNewSecret
(
"foo"
))
test
.
TestList
(
validNewSecret
(
"foo"
))
}
}
...
@@ -108,6 +113,7 @@ func TestList(t *testing.T) {
...
@@ -108,6 +113,7 @@ func TestList(t *testing.T) {
func
TestWatch
(
t
*
testing
.
T
)
{
func
TestWatch
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestWatch
(
test
.
TestWatch
(
validNewSecret
(
"foo"
),
validNewSecret
(
"foo"
),
...
...
pkg/registry/service/etcd/etcd.go
View file @
5b11b598
...
@@ -36,7 +36,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
...
@@ -36,7 +36,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
prefix
:=
"/"
+
opts
.
ResourcePrefix
prefix
:=
"/"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
ServiceList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
ServiceList
{}
}
storageInterface
,
_
:=
opts
.
Decorator
(
storageInterface
,
dFunc
:=
opts
.
Decorator
(
opts
.
StorageConfig
,
opts
.
StorageConfig
,
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
Services
),
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
Services
),
&
api
.
Service
{},
&
api
.
Service
{},
...
@@ -67,7 +67,8 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
...
@@ -67,7 +67,8 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
DeleteStrategy
:
service
.
Strategy
,
DeleteStrategy
:
service
.
Strategy
,
ExportStrategy
:
service
.
Strategy
,
ExportStrategy
:
service
.
Strategy
,
Storage
:
storageInterface
,
Storage
:
storageInterface
,
DestroyFunc
:
dFunc
,
}
}
statusStore
:=
*
store
statusStore
:=
*
store
statusStore
.
UpdateStrategy
=
service
.
StatusStrategy
statusStore
.
UpdateStrategy
=
service
.
StatusStrategy
...
...
pkg/registry/service/etcd/etcd_test.go
View file @
5b11b598
...
@@ -59,6 +59,7 @@ func validService() *api.Service {
...
@@ -59,6 +59,7 @@ func validService() *api.Service {
func
TestCreate
(
t
*
testing
.
T
)
{
func
TestCreate
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
validService
:=
validService
()
validService
:=
validService
()
validService
.
ObjectMeta
=
api
.
ObjectMeta
{}
validService
.
ObjectMeta
=
api
.
ObjectMeta
{}
...
@@ -89,6 +90,7 @@ func TestCreate(t *testing.T) {
...
@@ -89,6 +90,7 @@ func TestCreate(t *testing.T) {
func
TestUpdate
(
t
*
testing
.
T
)
{
func
TestUpdate
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
AllowCreateOnUpdate
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
AllowCreateOnUpdate
()
test
.
TestUpdate
(
test
.
TestUpdate
(
// valid
// valid
...
@@ -114,6 +116,7 @@ func TestUpdate(t *testing.T) {
...
@@ -114,6 +116,7 @@ func TestUpdate(t *testing.T) {
func
TestDelete
(
t
*
testing
.
T
)
{
func
TestDelete
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
AllowCreateOnUpdate
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
AllowCreateOnUpdate
()
test
.
TestDelete
(
validService
())
test
.
TestDelete
(
validService
())
}
}
...
@@ -121,6 +124,7 @@ func TestDelete(t *testing.T) {
...
@@ -121,6 +124,7 @@ func TestDelete(t *testing.T) {
func
TestGet
(
t
*
testing
.
T
)
{
func
TestGet
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
AllowCreateOnUpdate
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
AllowCreateOnUpdate
()
test
.
TestGet
(
validService
())
test
.
TestGet
(
validService
())
}
}
...
@@ -128,6 +132,7 @@ func TestGet(t *testing.T) {
...
@@ -128,6 +132,7 @@ func TestGet(t *testing.T) {
func
TestList
(
t
*
testing
.
T
)
{
func
TestList
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
AllowCreateOnUpdate
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
AllowCreateOnUpdate
()
test
.
TestList
(
validService
())
test
.
TestList
(
validService
())
}
}
...
@@ -135,6 +140,7 @@ func TestList(t *testing.T) {
...
@@ -135,6 +140,7 @@ func TestList(t *testing.T) {
func
TestWatch
(
t
*
testing
.
T
)
{
func
TestWatch
(
t
*
testing
.
T
)
{
storage
,
_
,
server
:=
newStorage
(
t
)
storage
,
_
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestWatch
(
test
.
TestWatch
(
validService
(),
validService
(),
...
...
pkg/registry/serviceaccount/etcd/etcd.go
View file @
5b11b598
...
@@ -35,7 +35,7 @@ func NewREST(opts generic.RESTOptions) *REST {
...
@@ -35,7 +35,7 @@ func NewREST(opts generic.RESTOptions) *REST {
prefix
:=
"/"
+
opts
.
ResourcePrefix
prefix
:=
"/"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
ServiceAccountList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
ServiceAccountList
{}
}
storageInterface
,
_
:=
opts
.
Decorator
(
storageInterface
,
dFunc
:=
opts
.
Decorator
(
opts
.
StorageConfig
,
opts
.
StorageConfig
,
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
ServiceAccounts
),
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
ServiceAccounts
),
&
api
.
ServiceAccount
{},
&
api
.
ServiceAccount
{},
...
@@ -66,7 +66,8 @@ func NewREST(opts generic.RESTOptions) *REST {
...
@@ -66,7 +66,8 @@ func NewREST(opts generic.RESTOptions) *REST {
DeleteStrategy
:
serviceaccount
.
Strategy
,
DeleteStrategy
:
serviceaccount
.
Strategy
,
ReturnDeletedObject
:
true
,
ReturnDeletedObject
:
true
,
Storage
:
storageInterface
,
Storage
:
storageInterface
,
DestroyFunc
:
dFunc
,
}
}
return
&
REST
{
store
}
return
&
REST
{
store
}
}
}
pkg/registry/serviceaccount/etcd/etcd_test.go
View file @
5b11b598
...
@@ -47,6 +47,7 @@ func validNewServiceAccount(name string) *api.ServiceAccount {
...
@@ -47,6 +47,7 @@ func validNewServiceAccount(name string) *api.ServiceAccount {
func
TestCreate
(
t
*
testing
.
T
)
{
func
TestCreate
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
serviceAccount
:=
validNewServiceAccount
(
"foo"
)
serviceAccount
:=
validNewServiceAccount
(
"foo"
)
serviceAccount
.
ObjectMeta
=
api
.
ObjectMeta
{
GenerateName
:
"foo-"
}
serviceAccount
.
ObjectMeta
=
api
.
ObjectMeta
{
GenerateName
:
"foo-"
}
...
@@ -64,6 +65,7 @@ func TestCreate(t *testing.T) {
...
@@ -64,6 +65,7 @@ func TestCreate(t *testing.T) {
func
TestUpdate
(
t
*
testing
.
T
)
{
func
TestUpdate
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestUpdate
(
test
.
TestUpdate
(
// valid
// valid
...
@@ -80,6 +82,7 @@ func TestUpdate(t *testing.T) {
...
@@ -80,6 +82,7 @@ func TestUpdate(t *testing.T) {
func
TestDelete
(
t
*
testing
.
T
)
{
func
TestDelete
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ReturnDeletedObject
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ReturnDeletedObject
()
test
.
TestDelete
(
validNewServiceAccount
(
"foo"
))
test
.
TestDelete
(
validNewServiceAccount
(
"foo"
))
}
}
...
@@ -87,6 +90,7 @@ func TestDelete(t *testing.T) {
...
@@ -87,6 +90,7 @@ func TestDelete(t *testing.T) {
func
TestGet
(
t
*
testing
.
T
)
{
func
TestGet
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestGet
(
validNewServiceAccount
(
"foo"
))
test
.
TestGet
(
validNewServiceAccount
(
"foo"
))
}
}
...
@@ -94,6 +98,7 @@ func TestGet(t *testing.T) {
...
@@ -94,6 +98,7 @@ func TestGet(t *testing.T) {
func
TestList
(
t
*
testing
.
T
)
{
func
TestList
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestList
(
validNewServiceAccount
(
"foo"
))
test
.
TestList
(
validNewServiceAccount
(
"foo"
))
}
}
...
@@ -101,6 +106,7 @@ func TestList(t *testing.T) {
...
@@ -101,6 +106,7 @@ func TestList(t *testing.T) {
func
TestWatch
(
t
*
testing
.
T
)
{
func
TestWatch
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestWatch
(
test
.
TestWatch
(
validNewServiceAccount
(
"foo"
),
validNewServiceAccount
(
"foo"
),
...
...
pkg/registry/storageclass/etcd/etcd.go
View file @
5b11b598
...
@@ -36,7 +36,7 @@ func NewREST(opts generic.RESTOptions) *REST {
...
@@ -36,7 +36,7 @@ func NewREST(opts generic.RESTOptions) *REST {
prefix
:=
"/"
+
opts
.
ResourcePrefix
prefix
:=
"/"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
storageapi
.
StorageClassList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
storageapi
.
StorageClassList
{}
}
storageInterface
,
_
:=
opts
.
Decorator
(
storageInterface
,
dFunc
:=
opts
.
Decorator
(
opts
.
StorageConfig
,
opts
.
StorageConfig
,
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
StorageClasses
),
cachesize
.
GetWatchCacheSizeByResource
(
cachesize
.
StorageClasses
),
&
storageapi
.
StorageClass
{},
&
storageapi
.
StorageClass
{},
...
@@ -67,7 +67,8 @@ func NewREST(opts generic.RESTOptions) *REST {
...
@@ -67,7 +67,8 @@ func NewREST(opts generic.RESTOptions) *REST {
DeleteStrategy
:
storageclass
.
Strategy
,
DeleteStrategy
:
storageclass
.
Strategy
,
ReturnDeletedObject
:
true
,
ReturnDeletedObject
:
true
,
Storage
:
storageInterface
,
Storage
:
storageInterface
,
DestroyFunc
:
dFunc
,
}
}
return
&
REST
{
store
}
return
&
REST
{
store
}
...
...
pkg/registry/storageclass/etcd/etcd_test.go
View file @
5b11b598
...
@@ -55,6 +55,7 @@ func validChangedStorageClass() *storageapi.StorageClass {
...
@@ -55,6 +55,7 @@ func validChangedStorageClass() *storageapi.StorageClass {
func
TestCreate
(
t
*
testing
.
T
)
{
func
TestCreate
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
storageClass
:=
validNewStorageClass
(
"foo"
)
storageClass
:=
validNewStorageClass
(
"foo"
)
storageClass
.
ObjectMeta
=
api
.
ObjectMeta
{
GenerateName
:
"foo"
}
storageClass
.
ObjectMeta
=
api
.
ObjectMeta
{
GenerateName
:
"foo"
}
...
@@ -71,6 +72,7 @@ func TestCreate(t *testing.T) {
...
@@ -71,6 +72,7 @@ func TestCreate(t *testing.T) {
func
TestUpdate
(
t
*
testing
.
T
)
{
func
TestUpdate
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
.
TestUpdate
(
test
.
TestUpdate
(
// valid
// valid
...
@@ -94,6 +96,7 @@ func TestUpdate(t *testing.T) {
...
@@ -94,6 +96,7 @@ func TestUpdate(t *testing.T) {
func
TestDelete
(
t
*
testing
.
T
)
{
func
TestDelete
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
.
ReturnDeletedObject
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
.
ReturnDeletedObject
()
test
.
TestDelete
(
validNewStorageClass
(
"foo"
))
test
.
TestDelete
(
validNewStorageClass
(
"foo"
))
}
}
...
@@ -101,6 +104,7 @@ func TestDelete(t *testing.T) {
...
@@ -101,6 +104,7 @@ func TestDelete(t *testing.T) {
func
TestGet
(
t
*
testing
.
T
)
{
func
TestGet
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
.
TestGet
(
validNewStorageClass
(
"foo"
))
test
.
TestGet
(
validNewStorageClass
(
"foo"
))
}
}
...
@@ -108,6 +112,7 @@ func TestGet(t *testing.T) {
...
@@ -108,6 +112,7 @@ func TestGet(t *testing.T) {
func
TestList
(
t
*
testing
.
T
)
{
func
TestList
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
.
TestList
(
validNewStorageClass
(
"foo"
))
test
.
TestList
(
validNewStorageClass
(
"foo"
))
}
}
...
@@ -115,6 +120,7 @@ func TestList(t *testing.T) {
...
@@ -115,6 +120,7 @@ func TestList(t *testing.T) {
func
TestWatch
(
t
*
testing
.
T
)
{
func
TestWatch
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
test
.
TestWatch
(
test
.
TestWatch
(
validNewStorageClass
(
"foo"
),
validNewStorageClass
(
"foo"
),
...
...
pkg/registry/thirdpartyresource/etcd/etcd.go
View file @
5b11b598
...
@@ -35,7 +35,7 @@ func NewREST(opts generic.RESTOptions) *REST {
...
@@ -35,7 +35,7 @@ func NewREST(opts generic.RESTOptions) *REST {
prefix
:=
"/"
+
opts
.
ResourcePrefix
prefix
:=
"/"
+
opts
.
ResourcePrefix
// We explicitly do NOT do any decoration here yet.
// We explicitly do NOT do any decoration here yet.
storageInterface
,
_
:=
generic
.
NewRawStorage
(
opts
.
StorageConfig
)
storageInterface
,
dFunc
:=
generic
.
NewRawStorage
(
opts
.
StorageConfig
)
store
:=
&
registry
.
Store
{
store
:=
&
registry
.
Store
{
NewFunc
:
func
()
runtime
.
Object
{
return
&
extensions
.
ThirdPartyResource
{}
},
NewFunc
:
func
()
runtime
.
Object
{
return
&
extensions
.
ThirdPartyResource
{}
},
...
@@ -56,7 +56,8 @@ func NewREST(opts generic.RESTOptions) *REST {
...
@@ -56,7 +56,8 @@ func NewREST(opts generic.RESTOptions) *REST {
UpdateStrategy
:
thirdpartyresource
.
Strategy
,
UpdateStrategy
:
thirdpartyresource
.
Strategy
,
DeleteStrategy
:
thirdpartyresource
.
Strategy
,
DeleteStrategy
:
thirdpartyresource
.
Strategy
,
Storage
:
storageInterface
,
Storage
:
storageInterface
,
DestroyFunc
:
dFunc
,
}
}
return
&
REST
{
store
}
return
&
REST
{
store
}
...
...
pkg/registry/thirdpartyresource/etcd/etcd_test.go
View file @
5b11b598
...
@@ -58,6 +58,7 @@ func namer(i int) string {
...
@@ -58,6 +58,7 @@ func namer(i int) string {
func
TestCreate
(
t
*
testing
.
T
)
{
func
TestCreate
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
.
Namer
(
namer
)
.
GeneratesName
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
.
Namer
(
namer
)
.
GeneratesName
()
rsrc
:=
validNewThirdPartyResource
(
"kind.domain.tld"
)
rsrc
:=
validNewThirdPartyResource
(
"kind.domain.tld"
)
test
.
TestCreate
(
test
.
TestCreate
(
...
@@ -75,6 +76,7 @@ func TestCreate(t *testing.T) {
...
@@ -75,6 +76,7 @@ func TestCreate(t *testing.T) {
func
TestUpdate
(
t
*
testing
.
T
)
{
func
TestUpdate
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
.
Namer
(
namer
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
.
Namer
(
namer
)
test
.
TestUpdate
(
test
.
TestUpdate
(
// valid
// valid
...
@@ -91,6 +93,7 @@ func TestUpdate(t *testing.T) {
...
@@ -91,6 +93,7 @@ func TestUpdate(t *testing.T) {
func
TestDelete
(
t
*
testing
.
T
)
{
func
TestDelete
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
.
Namer
(
namer
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
.
Namer
(
namer
)
test
.
TestDelete
(
validNewThirdPartyResource
(
"kind.domain.tld"
))
test
.
TestDelete
(
validNewThirdPartyResource
(
"kind.domain.tld"
))
}
}
...
@@ -98,6 +101,7 @@ func TestDelete(t *testing.T) {
...
@@ -98,6 +101,7 @@ func TestDelete(t *testing.T) {
func
TestGet
(
t
*
testing
.
T
)
{
func
TestGet
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
.
Namer
(
namer
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
.
Namer
(
namer
)
test
.
TestGet
(
validNewThirdPartyResource
(
"kind.domain.tld"
))
test
.
TestGet
(
validNewThirdPartyResource
(
"kind.domain.tld"
))
}
}
...
@@ -105,6 +109,7 @@ func TestGet(t *testing.T) {
...
@@ -105,6 +109,7 @@ func TestGet(t *testing.T) {
func
TestList
(
t
*
testing
.
T
)
{
func
TestList
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
.
Namer
(
namer
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
.
Namer
(
namer
)
test
.
TestList
(
validNewThirdPartyResource
(
"kind.domain.tld"
))
test
.
TestList
(
validNewThirdPartyResource
(
"kind.domain.tld"
))
}
}
...
@@ -112,6 +117,7 @@ func TestList(t *testing.T) {
...
@@ -112,6 +117,7 @@ func TestList(t *testing.T) {
func
TestWatch
(
t
*
testing
.
T
)
{
func
TestWatch
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
.
Namer
(
namer
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
.
ClusterScope
()
.
Namer
(
namer
)
test
.
TestWatch
(
test
.
TestWatch
(
validNewThirdPartyResource
(
"kind.domain.tld"
),
validNewThirdPartyResource
(
"kind.domain.tld"
),
...
...
pkg/registry/thirdpartyresourcedata/etcd/etcd.go
View file @
5b11b598
...
@@ -38,7 +38,7 @@ func NewREST(opts generic.RESTOptions, group, kind string) *REST {
...
@@ -38,7 +38,7 @@ func NewREST(opts generic.RESTOptions, group, kind string) *REST {
prefix
:=
"/ThirdPartyResourceData/"
+
group
+
"/"
+
strings
.
ToLower
(
kind
)
+
"s"
prefix
:=
"/ThirdPartyResourceData/"
+
group
+
"/"
+
strings
.
ToLower
(
kind
)
+
"s"
// We explicitly do NOT do any decoration here yet.
// We explicitly do NOT do any decoration here yet.
storageInterface
,
_
:=
generic
.
NewRawStorage
(
opts
.
StorageConfig
)
storageInterface
,
dFunc
:=
generic
.
NewRawStorage
(
opts
.
StorageConfig
)
store
:=
&
registry
.
Store
{
store
:=
&
registry
.
Store
{
NewFunc
:
func
()
runtime
.
Object
{
return
&
extensions
.
ThirdPartyResourceData
{}
},
NewFunc
:
func
()
runtime
.
Object
{
return
&
extensions
.
ThirdPartyResourceData
{}
},
...
@@ -59,7 +59,8 @@ func NewREST(opts generic.RESTOptions, group, kind string) *REST {
...
@@ -59,7 +59,8 @@ func NewREST(opts generic.RESTOptions, group, kind string) *REST {
UpdateStrategy
:
thirdpartyresourcedata
.
Strategy
,
UpdateStrategy
:
thirdpartyresourcedata
.
Strategy
,
DeleteStrategy
:
thirdpartyresourcedata
.
Strategy
,
DeleteStrategy
:
thirdpartyresourcedata
.
Strategy
,
Storage
:
storageInterface
,
Storage
:
storageInterface
,
DestroyFunc
:
dFunc
,
}
}
return
&
REST
{
return
&
REST
{
...
...
pkg/registry/thirdpartyresourcedata/etcd/etcd_test.go
View file @
5b11b598
...
@@ -50,6 +50,7 @@ func validNewThirdPartyResourceData(name string) *extensions.ThirdPartyResourceD
...
@@ -50,6 +50,7 @@ func validNewThirdPartyResourceData(name string) *extensions.ThirdPartyResourceD
func
TestCreate
(
t
*
testing
.
T
)
{
func
TestCreate
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
rsrc
:=
validNewThirdPartyResourceData
(
"foo"
)
rsrc
:=
validNewThirdPartyResourceData
(
"foo"
)
rsrc
.
ObjectMeta
=
api
.
ObjectMeta
{}
rsrc
.
ObjectMeta
=
api
.
ObjectMeta
{}
...
@@ -64,6 +65,7 @@ func TestCreate(t *testing.T) {
...
@@ -64,6 +65,7 @@ func TestCreate(t *testing.T) {
func
TestUpdate
(
t
*
testing
.
T
)
{
func
TestUpdate
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestUpdate
(
test
.
TestUpdate
(
// valid
// valid
...
@@ -80,6 +82,7 @@ func TestUpdate(t *testing.T) {
...
@@ -80,6 +82,7 @@ func TestUpdate(t *testing.T) {
func
TestDelete
(
t
*
testing
.
T
)
{
func
TestDelete
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestDelete
(
validNewThirdPartyResourceData
(
"foo"
))
test
.
TestDelete
(
validNewThirdPartyResourceData
(
"foo"
))
}
}
...
@@ -87,6 +90,7 @@ func TestDelete(t *testing.T) {
...
@@ -87,6 +90,7 @@ func TestDelete(t *testing.T) {
func
TestGet
(
t
*
testing
.
T
)
{
func
TestGet
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestGet
(
validNewThirdPartyResourceData
(
"foo"
))
test
.
TestGet
(
validNewThirdPartyResourceData
(
"foo"
))
}
}
...
@@ -94,6 +98,7 @@ func TestGet(t *testing.T) {
...
@@ -94,6 +98,7 @@ func TestGet(t *testing.T) {
func
TestList
(
t
*
testing
.
T
)
{
func
TestList
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestList
(
validNewThirdPartyResourceData
(
"foo"
))
test
.
TestList
(
validNewThirdPartyResourceData
(
"foo"
))
}
}
...
@@ -101,6 +106,7 @@ func TestList(t *testing.T) {
...
@@ -101,6 +106,7 @@ func TestList(t *testing.T) {
func
TestWatch
(
t
*
testing
.
T
)
{
func
TestWatch
(
t
*
testing
.
T
)
{
storage
,
server
:=
newStorage
(
t
)
storage
,
server
:=
newStorage
(
t
)
defer
server
.
Terminate
(
t
)
defer
server
.
Terminate
(
t
)
defer
storage
.
Store
.
DestroyFunc
()
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
:=
registrytest
.
New
(
t
,
storage
.
Store
)
test
.
TestWatch
(
test
.
TestWatch
(
validNewThirdPartyResourceData
(
"foo"
),
validNewThirdPartyResourceData
(
"foo"
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment