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
30262956
Commit
30262956
authored
Jan 12, 2015
by
Clayton Coleman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unimplemented methods
parent
22c99c98
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
0 additions
and
82 deletions
+0
-82
rest.go
pkg/registry/binding/rest.go
+0
-22
rest_test.go
pkg/registry/binding/rest_test.go
+0
-25
rest.go
pkg/registry/endpoint/rest.go
+0
-5
rest_test.go
pkg/registry/endpoint/rest_test.go
+0
-11
rest.go
pkg/registry/event/rest.go
+0
-5
rest_test.go
pkg/registry/event/rest_test.go
+0
-14
No files found.
pkg/registry/binding/rest.go
View file @
30262956
...
...
@@ -20,9 +20,7 @@ import (
"fmt"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors"
"github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver"
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
)
...
...
@@ -40,21 +38,6 @@ func NewREST(bindingRegistry Registry) *REST {
}
}
// List returns an error because bindings are write-only objects.
func
(
*
REST
)
List
(
ctx
api
.
Context
,
label
,
field
labels
.
Selector
)
(
runtime
.
Object
,
error
)
{
return
nil
,
errors
.
NewNotFound
(
"binding"
,
"list"
)
}
// Get returns an error because bindings are write-only objects.
func
(
*
REST
)
Get
(
ctx
api
.
Context
,
id
string
)
(
runtime
.
Object
,
error
)
{
return
nil
,
errors
.
NewNotFound
(
"binding"
,
id
)
}
// Delete returns an error because bindings are write-only objects.
func
(
*
REST
)
Delete
(
ctx
api
.
Context
,
id
string
)
(
<-
chan
apiserver
.
RESTResult
,
error
)
{
return
nil
,
errors
.
NewNotFound
(
"binding"
,
id
)
}
// New returns a new binding object fit for having data unmarshalled into it.
func
(
*
REST
)
New
()
runtime
.
Object
{
return
&
api
.
Binding
{}
...
...
@@ -73,8 +56,3 @@ func (b *REST) Create(ctx api.Context, obj runtime.Object) (<-chan apiserver.RES
return
&
api
.
Status
{
Status
:
api
.
StatusSuccess
},
nil
}),
nil
}
// Update returns an error-- this object may not be updated.
func
(
b
*
REST
)
Update
(
ctx
api
.
Context
,
obj
runtime
.
Object
)
(
<-
chan
apiserver
.
RESTResult
,
error
)
{
return
nil
,
fmt
.
Errorf
(
"bindings may not be changed."
)
}
pkg/registry/binding/rest_test.go
View file @
30262956
...
...
@@ -24,7 +24,6 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/latest"
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
)
func
TestNewREST
(
t
*
testing
.
T
)
{
...
...
@@ -51,30 +50,6 @@ func TestNewREST(t *testing.T) {
}
}
func
TestRESTUnsupported
(
t
*
testing
.
T
)
{
var
ctx
api
.
Context
mockRegistry
:=
MockRegistry
{
OnApplyBinding
:
func
(
b
*
api
.
Binding
)
error
{
return
nil
},
}
b
:=
NewREST
(
mockRegistry
)
if
_
,
err
:=
b
.
Delete
(
ctx
,
"binding id"
);
err
==
nil
{
t
.
Errorf
(
"unexpected non-error"
)
}
if
_
,
err
:=
b
.
Update
(
ctx
,
&
api
.
Binding
{
PodID
:
"foo"
,
Host
:
"new machine"
});
err
==
nil
{
t
.
Errorf
(
"unexpected non-error"
)
}
if
_
,
err
:=
b
.
Get
(
ctx
,
"binding id"
);
err
==
nil
{
t
.
Errorf
(
"unexpected non-error"
)
}
if
_
,
err
:=
b
.
List
(
ctx
,
labels
.
Set
{
"name"
:
"foo"
}
.
AsSelector
(),
labels
.
Everything
());
err
==
nil
{
t
.
Errorf
(
"unexpected non-error"
)
}
// Try sending wrong object just to get 100% coverage
if
_
,
err
:=
b
.
Create
(
ctx
,
&
api
.
Pod
{});
err
==
nil
{
t
.
Errorf
(
"unexpected non-error"
)
}
}
func
TestRESTPost
(
t
*
testing
.
T
)
{
table
:=
[]
struct
{
b
*
api
.
Binding
...
...
pkg/registry/endpoint/rest.go
View file @
30262956
...
...
@@ -96,11 +96,6 @@ func (rs *REST) Update(ctx api.Context, obj runtime.Object) (<-chan apiserver.RE
}),
nil
}
// Delete satisfies the RESTStorage interface but is unimplemented.
func
(
rs
*
REST
)
Delete
(
ctx
api
.
Context
,
id
string
)
(
<-
chan
apiserver
.
RESTResult
,
error
)
{
return
nil
,
errors
.
NewBadRequest
(
"Endpoints are read-only"
)
}
// New implements the RESTStorage interface.
func
(
rs
REST
)
New
()
runtime
.
Object
{
return
&
api
.
Endpoints
{}
...
...
pkg/registry/endpoint/rest_test.go
View file @
30262956
...
...
@@ -96,14 +96,3 @@ func TestEndpointsRegistryList(t *testing.T) {
t
.
Errorf
(
"Unexpected resource version: %#v"
,
sl
)
}
}
func
TestEndpointsRegistryDelete
(
t
*
testing
.
T
)
{
registry
:=
registrytest
.
NewServiceRegistry
()
storage
:=
NewREST
(
registry
)
_
,
err
:=
storage
.
Delete
(
api
.
NewContext
(),
"n/a"
)
if
err
==
nil
{
t
.
Error
(
"unexpected non-error"
)
}
else
if
!
errors
.
IsBadRequest
(
err
)
{
t
.
Errorf
(
"unexpected error: %v"
,
err
)
}
}
pkg/registry/event/rest.go
View file @
30262956
...
...
@@ -131,8 +131,3 @@ func (*REST) New() runtime.Object {
func
(
*
REST
)
NewList
()
runtime
.
Object
{
return
&
api
.
EventList
{}
}
// Update returns an error: Events are not mutable.
func
(
rs
*
REST
)
Update
(
ctx
api
.
Context
,
obj
runtime
.
Object
)
(
<-
chan
apiserver
.
RESTResult
,
error
)
{
return
nil
,
fmt
.
Errorf
(
"not allowed: 'Event' objects are not mutable"
)
}
pkg/registry/event/rest_test.go
View file @
30262956
...
...
@@ -172,20 +172,6 @@ func TestRESTgetAttrs(t *testing.T) {
}
}
func
TestRESTUpdate
(
t
*
testing
.
T
)
{
_
,
rest
:=
NewTestREST
()
eventA
:=
testEvent
(
"foo"
)
c
,
err
:=
rest
.
Create
(
api
.
NewDefaultContext
(),
eventA
)
if
err
!=
nil
{
t
.
Fatalf
(
"Unexpected error %v"
,
err
)
}
<-
c
_
,
err
=
rest
.
Update
(
api
.
NewDefaultContext
(),
eventA
)
if
err
==
nil
{
t
.
Errorf
(
"unexpected non-error"
)
}
}
func
TestRESTList
(
t
*
testing
.
T
)
{
reg
,
rest
:=
NewTestREST
()
eventA
:=
&
api
.
Event
{
...
...
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