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
436790cc
Commit
436790cc
authored
Feb 24, 2015
by
James DeFelice
Committed by
James DeFelice
Mar 09, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add unit test for #4757
fixed compilation error
parent
53ec66ca
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
0 deletions
+28
-0
etcd_test.go
pkg/registry/pod/etcd/etcd_test.go
+28
-0
No files found.
pkg/registry/pod/etcd/etcd_test.go
View file @
436790cc
...
...
@@ -24,6 +24,7 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors"
etcderrors
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors/etcd"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/latest"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/rest/resttest"
"github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver"
...
...
@@ -846,6 +847,33 @@ func TestEtcdCreate(t *testing.T) {
}
}
func
TestEtcdCreateBindingNoPod
(
t
*
testing
.
T
)
{
registry
,
bindingRegistry
,
fakeClient
,
_
:=
newStorage
(
t
)
ctx
:=
api
.
NewDefaultContext
()
fakeClient
.
TestIndex
=
true
key
,
_
:=
registry
.
store
.
KeyFunc
(
ctx
,
"foo"
)
fakeClient
.
Data
[
key
]
=
tools
.
EtcdResponseWithError
{
R
:
&
etcd
.
Response
{
Node
:
nil
,
},
E
:
tools
.
EtcdErrorNotFound
,
}
// Assume that a pod has undergone the following:
// - Create (apiserver)
// - Schedule (scheduler)
// - Delete (apiserver)
_
,
err
:=
bindingRegistry
.
Create
(
ctx
,
&
api
.
Binding
{
PodID
:
"foo"
,
Host
:
"machine"
,
ObjectMeta
:
api
.
ObjectMeta
{
Namespace
:
api
.
NamespaceDefault
}})
if
!
errors
.
IsNotFound
(
etcderrors
.
InterpretGetError
(
err
,
"Pod"
,
"foo"
))
{
t
.
Fatalf
(
"Unexpected error returned: %#v"
,
err
)
}
_
,
err
=
registry
.
Get
(
ctx
,
"foo"
)
if
!
errors
.
IsNotFound
(
etcderrors
.
InterpretGetError
(
err
,
"Pod"
,
"foo"
))
{
t
.
Fatalf
(
"Unexpected error: %v"
,
err
)
}
}
func
TestEtcdCreateFailsWithoutNamespace
(
t
*
testing
.
T
)
{
registry
,
_
,
_
,
fakeClient
,
_
:=
newStorage
(
t
)
fakeClient
.
TestIndex
=
true
...
...
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