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
08d9e244
Commit
08d9e244
authored
Apr 08, 2015
by
nikhiljindal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removing some references to v1beta1 from test code
parent
c4cbc9bc
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
49 additions
and
45 deletions
+49
-45
local-up-cluster.sh
hack/local-up-cluster.sh
+1
-1
ref_test.go
pkg/api/ref_test.go
+5
-5
event_test.go
pkg/client/record/event_test.go
+18
-19
events_cache_test.go
pkg/client/record/events_cache_test.go
+2
-2
kubectl.go
pkg/kubectl/kubectl.go
+0
-2
etcd_helper_test.go
pkg/tools/etcd_helper_test.go
+19
-11
encoder_test.go
pkg/watch/json/encoder_test.go
+4
-5
No files found.
hack/local-up-cluster.sh
View file @
08d9e244
...
@@ -127,7 +127,7 @@ APISERVER_PID=$!
...
@@ -127,7 +127,7 @@ APISERVER_PID=$!
# Wait for kube-apiserver to come up before launching the rest of the components.
# Wait for kube-apiserver to come up before launching the rest of the components.
echo
"Waiting for apiserver to come up"
echo
"Waiting for apiserver to come up"
kube::util::wait_for_url
"http://
${
API_HOST
}
:
${
API_PORT
}
/api/v1beta
1
/pods"
"apiserver: "
1 10
||
exit
1
kube::util::wait_for_url
"http://
${
API_HOST
}
:
${
API_PORT
}
/api/v1beta
3
/pods"
"apiserver: "
1 10
||
exit
1
CTLRMGR_LOG
=
/tmp/kube-controller-manager.log
CTLRMGR_LOG
=
/tmp/kube-controller-manager.log
sudo
-E
"
${
GO_OUT
}
/kube-controller-manager"
\
sudo
-E
"
${
GO_OUT
}
/kube-controller-manager"
\
...
...
pkg/api/ref_test.go
View file @
08d9e244
...
@@ -40,13 +40,13 @@ func TestGetReference(t *testing.T) {
...
@@ -40,13 +40,13 @@ func TestGetReference(t *testing.T) {
Name
:
"foo"
,
Name
:
"foo"
,
UID
:
"bar"
,
UID
:
"bar"
,
ResourceVersion
:
"42"
,
ResourceVersion
:
"42"
,
SelfLink
:
"/api/v
1beta
1/pods/foo"
,
SelfLink
:
"/api/v
ersion
1/pods/foo"
,
},
},
},
},
fieldPath
:
".desiredState.containers[0]"
,
fieldPath
:
".desiredState.containers[0]"
,
ref
:
&
ObjectReference
{
ref
:
&
ObjectReference
{
Kind
:
"Pod"
,
Kind
:
"Pod"
,
APIVersion
:
"v
1beta
1"
,
APIVersion
:
"v
ersion
1"
,
Name
:
"foo"
,
Name
:
"foo"
,
UID
:
"bar"
,
UID
:
"bar"
,
ResourceVersion
:
"42"
,
ResourceVersion
:
"42"
,
...
@@ -57,12 +57,12 @@ func TestGetReference(t *testing.T) {
...
@@ -57,12 +57,12 @@ func TestGetReference(t *testing.T) {
obj
:
&
ServiceList
{
obj
:
&
ServiceList
{
ListMeta
:
ListMeta
{
ListMeta
:
ListMeta
{
ResourceVersion
:
"42"
,
ResourceVersion
:
"42"
,
SelfLink
:
"/api/v
1beta
2/services"
,
SelfLink
:
"/api/v
ersion
2/services"
,
},
},
},
},
ref
:
&
ObjectReference
{
ref
:
&
ObjectReference
{
Kind
:
"ServiceList"
,
Kind
:
"ServiceList"
,
APIVersion
:
"v
1beta
2"
,
APIVersion
:
"v
ersion
2"
,
ResourceVersion
:
"42"
,
ResourceVersion
:
"42"
,
},
},
},
},
...
@@ -70,7 +70,7 @@ func TestGetReference(t *testing.T) {
...
@@ -70,7 +70,7 @@ func TestGetReference(t *testing.T) {
obj
:
&
ServiceList
{
obj
:
&
ServiceList
{
ListMeta
:
ListMeta
{
ListMeta
:
ListMeta
{
ResourceVersion
:
"42"
,
ResourceVersion
:
"42"
,
SelfLink
:
"v
1beta
2/services"
,
SelfLink
:
"v
ersion
2/services"
,
},
},
},
},
shouldErr
:
true
,
shouldErr
:
true
,
...
...
pkg/client/record/event_test.go
View file @
08d9e244
...
@@ -59,7 +59,7 @@ func (t *testEventSink) Update(e *api.Event) (*api.Event, error) {
...
@@ -59,7 +59,7 @@ func (t *testEventSink) Update(e *api.Event) (*api.Event, error) {
func
TestEventf
(
t
*
testing
.
T
)
{
func
TestEventf
(
t
*
testing
.
T
)
{
testPod
:=
&
api
.
Pod
{
testPod
:=
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
SelfLink
:
"/api/v
1beta1
/pods/foo"
,
SelfLink
:
"/api/v
ersion
/pods/foo"
,
Name
:
"foo"
,
Name
:
"foo"
,
Namespace
:
"baz"
,
Namespace
:
"baz"
,
UID
:
"bar"
,
UID
:
"bar"
,
...
@@ -67,13 +67,12 @@ func TestEventf(t *testing.T) {
...
@@ -67,13 +67,12 @@ func TestEventf(t *testing.T) {
}
}
testPod2
:=
&
api
.
Pod
{
testPod2
:=
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
SelfLink
:
"/api/v
1beta1
/pods/foo"
,
SelfLink
:
"/api/v
ersion
/pods/foo"
,
Name
:
"foo"
,
Name
:
"foo"
,
Namespace
:
"baz"
,
Namespace
:
"baz"
,
UID
:
"differentUid"
,
UID
:
"differentUid"
,
},
},
}
}
testRef
,
err
:=
api
.
GetPartialReference
(
testPod
,
"desiredState.manifest.containers[2]"
)
testRef
,
err
:=
api
.
GetPartialReference
(
testPod
,
"desiredState.manifest.containers[2]"
)
testRef2
,
err
:=
api
.
GetPartialReference
(
testPod2
,
"desiredState.manifest.containers[3]"
)
testRef2
,
err
:=
api
.
GetPartialReference
(
testPod2
,
"desiredState.manifest.containers[3]"
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -103,7 +102,7 @@ func TestEventf(t *testing.T) {
...
@@ -103,7 +102,7 @@ func TestEventf(t *testing.T) {
Name
:
"foo"
,
Name
:
"foo"
,
Namespace
:
"baz"
,
Namespace
:
"baz"
,
UID
:
"bar"
,
UID
:
"bar"
,
APIVersion
:
"v
1beta1
"
,
APIVersion
:
"v
ersion
"
,
FieldPath
:
"desiredState.manifest.containers[2]"
,
FieldPath
:
"desiredState.manifest.containers[2]"
,
},
},
Reason
:
"Started"
,
Reason
:
"Started"
,
...
@@ -111,7 +110,7 @@ func TestEventf(t *testing.T) {
...
@@ -111,7 +110,7 @@ func TestEventf(t *testing.T) {
Source
:
api
.
EventSource
{
Component
:
"eventTest"
},
Source
:
api
.
EventSource
{
Component
:
"eventTest"
},
Count
:
1
,
Count
:
1
,
},
},
expectLog
:
`Event(api.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"v
1beta1
", ResourceVersion:"", FieldPath:"desiredState.manifest.containers[2]"}): reason: 'Started' some verbose message: 1`
,
expectLog
:
`Event(api.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"v
ersion
", ResourceVersion:"", FieldPath:"desiredState.manifest.containers[2]"}): reason: 'Started' some verbose message: 1`
,
expectUpdate
:
false
,
expectUpdate
:
false
,
},
},
{
{
...
@@ -129,14 +128,14 @@ func TestEventf(t *testing.T) {
...
@@ -129,14 +128,14 @@ func TestEventf(t *testing.T) {
Name
:
"foo"
,
Name
:
"foo"
,
Namespace
:
"baz"
,
Namespace
:
"baz"
,
UID
:
"bar"
,
UID
:
"bar"
,
APIVersion
:
"v
1beta1
"
,
APIVersion
:
"v
ersion
"
,
},
},
Reason
:
"Killed"
,
Reason
:
"Killed"
,
Message
:
"some other verbose message: 1"
,
Message
:
"some other verbose message: 1"
,
Source
:
api
.
EventSource
{
Component
:
"eventTest"
},
Source
:
api
.
EventSource
{
Component
:
"eventTest"
},
Count
:
1
,
Count
:
1
,
},
},
expectLog
:
`Event(api.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"v
1beta1
", ResourceVersion:"", FieldPath:""}): reason: 'Killed' some other verbose message: 1`
,
expectLog
:
`Event(api.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"v
ersion
", ResourceVersion:"", FieldPath:""}): reason: 'Killed' some other verbose message: 1`
,
expectUpdate
:
false
,
expectUpdate
:
false
,
},
},
{
{
...
@@ -154,7 +153,7 @@ func TestEventf(t *testing.T) {
...
@@ -154,7 +153,7 @@ func TestEventf(t *testing.T) {
Name
:
"foo"
,
Name
:
"foo"
,
Namespace
:
"baz"
,
Namespace
:
"baz"
,
UID
:
"bar"
,
UID
:
"bar"
,
APIVersion
:
"v
1beta1
"
,
APIVersion
:
"v
ersion
"
,
FieldPath
:
"desiredState.manifest.containers[2]"
,
FieldPath
:
"desiredState.manifest.containers[2]"
,
},
},
Reason
:
"Started"
,
Reason
:
"Started"
,
...
@@ -162,7 +161,7 @@ func TestEventf(t *testing.T) {
...
@@ -162,7 +161,7 @@ func TestEventf(t *testing.T) {
Source
:
api
.
EventSource
{
Component
:
"eventTest"
},
Source
:
api
.
EventSource
{
Component
:
"eventTest"
},
Count
:
2
,
Count
:
2
,
},
},
expectLog
:
`Event(api.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"v
1beta1
", ResourceVersion:"", FieldPath:"desiredState.manifest.containers[2]"}): reason: 'Started' some verbose message: 1`
,
expectLog
:
`Event(api.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"v
ersion
", ResourceVersion:"", FieldPath:"desiredState.manifest.containers[2]"}): reason: 'Started' some verbose message: 1`
,
expectUpdate
:
true
,
expectUpdate
:
true
,
},
},
{
{
...
@@ -180,7 +179,7 @@ func TestEventf(t *testing.T) {
...
@@ -180,7 +179,7 @@ func TestEventf(t *testing.T) {
Name
:
"foo"
,
Name
:
"foo"
,
Namespace
:
"baz"
,
Namespace
:
"baz"
,
UID
:
"differentUid"
,
UID
:
"differentUid"
,
APIVersion
:
"v
1beta1
"
,
APIVersion
:
"v
ersion
"
,
FieldPath
:
"desiredState.manifest.containers[3]"
,
FieldPath
:
"desiredState.manifest.containers[3]"
,
},
},
Reason
:
"Started"
,
Reason
:
"Started"
,
...
@@ -188,7 +187,7 @@ func TestEventf(t *testing.T) {
...
@@ -188,7 +187,7 @@ func TestEventf(t *testing.T) {
Source
:
api
.
EventSource
{
Component
:
"eventTest"
},
Source
:
api
.
EventSource
{
Component
:
"eventTest"
},
Count
:
1
,
Count
:
1
,
},
},
expectLog
:
`Event(api.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"differentUid", APIVersion:"v
1beta1
", ResourceVersion:"", FieldPath:"desiredState.manifest.containers[3]"}): reason: 'Started' some verbose message: 1`
,
expectLog
:
`Event(api.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"differentUid", APIVersion:"v
ersion
", ResourceVersion:"", FieldPath:"desiredState.manifest.containers[3]"}): reason: 'Started' some verbose message: 1`
,
expectUpdate
:
false
,
expectUpdate
:
false
,
},
},
{
{
...
@@ -206,7 +205,7 @@ func TestEventf(t *testing.T) {
...
@@ -206,7 +205,7 @@ func TestEventf(t *testing.T) {
Name
:
"foo"
,
Name
:
"foo"
,
Namespace
:
"baz"
,
Namespace
:
"baz"
,
UID
:
"bar"
,
UID
:
"bar"
,
APIVersion
:
"v
1beta1
"
,
APIVersion
:
"v
ersion
"
,
FieldPath
:
"desiredState.manifest.containers[2]"
,
FieldPath
:
"desiredState.manifest.containers[2]"
,
},
},
Reason
:
"Started"
,
Reason
:
"Started"
,
...
@@ -214,7 +213,7 @@ func TestEventf(t *testing.T) {
...
@@ -214,7 +213,7 @@ func TestEventf(t *testing.T) {
Source
:
api
.
EventSource
{
Component
:
"eventTest"
},
Source
:
api
.
EventSource
{
Component
:
"eventTest"
},
Count
:
3
,
Count
:
3
,
},
},
expectLog
:
`Event(api.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"v
1beta1
", ResourceVersion:"", FieldPath:"desiredState.manifest.containers[2]"}): reason: 'Started' some verbose message: 1`
,
expectLog
:
`Event(api.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"v
ersion
", ResourceVersion:"", FieldPath:"desiredState.manifest.containers[2]"}): reason: 'Started' some verbose message: 1`
,
expectUpdate
:
true
,
expectUpdate
:
true
,
},
},
{
{
...
@@ -232,7 +231,7 @@ func TestEventf(t *testing.T) {
...
@@ -232,7 +231,7 @@ func TestEventf(t *testing.T) {
Name
:
"foo"
,
Name
:
"foo"
,
Namespace
:
"baz"
,
Namespace
:
"baz"
,
UID
:
"differentUid"
,
UID
:
"differentUid"
,
APIVersion
:
"v
1beta1
"
,
APIVersion
:
"v
ersion
"
,
FieldPath
:
"desiredState.manifest.containers[3]"
,
FieldPath
:
"desiredState.manifest.containers[3]"
,
},
},
Reason
:
"Stopped"
,
Reason
:
"Stopped"
,
...
@@ -240,7 +239,7 @@ func TestEventf(t *testing.T) {
...
@@ -240,7 +239,7 @@ func TestEventf(t *testing.T) {
Source
:
api
.
EventSource
{
Component
:
"eventTest"
},
Source
:
api
.
EventSource
{
Component
:
"eventTest"
},
Count
:
1
,
Count
:
1
,
},
},
expectLog
:
`Event(api.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"differentUid", APIVersion:"v
1beta1
", ResourceVersion:"", FieldPath:"desiredState.manifest.containers[3]"}): reason: 'Stopped' some verbose message: 1`
,
expectLog
:
`Event(api.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"differentUid", APIVersion:"v
ersion
", ResourceVersion:"", FieldPath:"desiredState.manifest.containers[3]"}): reason: 'Stopped' some verbose message: 1`
,
expectUpdate
:
false
,
expectUpdate
:
false
,
},
},
{
{
...
@@ -258,7 +257,7 @@ func TestEventf(t *testing.T) {
...
@@ -258,7 +257,7 @@ func TestEventf(t *testing.T) {
Name
:
"foo"
,
Name
:
"foo"
,
Namespace
:
"baz"
,
Namespace
:
"baz"
,
UID
:
"differentUid"
,
UID
:
"differentUid"
,
APIVersion
:
"v
1beta1
"
,
APIVersion
:
"v
ersion
"
,
FieldPath
:
"desiredState.manifest.containers[3]"
,
FieldPath
:
"desiredState.manifest.containers[3]"
,
},
},
Reason
:
"Stopped"
,
Reason
:
"Stopped"
,
...
@@ -266,7 +265,7 @@ func TestEventf(t *testing.T) {
...
@@ -266,7 +265,7 @@ func TestEventf(t *testing.T) {
Source
:
api
.
EventSource
{
Component
:
"eventTest"
},
Source
:
api
.
EventSource
{
Component
:
"eventTest"
},
Count
:
2
,
Count
:
2
,
},
},
expectLog
:
`Event(api.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"differentUid", APIVersion:"v
1beta1
", ResourceVersion:"", FieldPath:"desiredState.manifest.containers[3]"}): reason: 'Stopped' some verbose message: 1`
,
expectLog
:
`Event(api.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"differentUid", APIVersion:"v
ersion
", ResourceVersion:"", FieldPath:"desiredState.manifest.containers[3]"}): reason: 'Stopped' some verbose message: 1`
,
expectUpdate
:
true
,
expectUpdate
:
true
,
},
},
}
}
...
@@ -350,7 +349,7 @@ func TestWriteEventError(t *testing.T) {
...
@@ -350,7 +349,7 @@ func TestWriteEventError(t *testing.T) {
Name
:
"foo"
,
Name
:
"foo"
,
Namespace
:
"baz"
,
Namespace
:
"baz"
,
UID
:
"bar"
,
UID
:
"bar"
,
APIVersion
:
"v
1beta1
"
,
APIVersion
:
"v
ersion
"
,
}
}
type
entry
struct
{
type
entry
struct
{
timesToSendError
int
timesToSendError
int
...
@@ -455,7 +454,7 @@ func TestLotsOfEvents(t *testing.T) {
...
@@ -455,7 +454,7 @@ func TestLotsOfEvents(t *testing.T) {
Name
:
"foo"
,
Name
:
"foo"
,
Namespace
:
"baz"
,
Namespace
:
"baz"
,
UID
:
"bar"
,
UID
:
"bar"
,
APIVersion
:
"v
1beta1
"
,
APIVersion
:
"v
ersion
"
,
}
}
for
i
:=
0
;
i
<
maxQueuedEvents
;
i
++
{
for
i
:=
0
;
i
<
maxQueuedEvents
;
i
++
{
go
recorder
.
Eventf
(
ref
,
"Reason"
,
strconv
.
Itoa
(
i
))
go
recorder
.
Eventf
(
ref
,
"Reason"
,
strconv
.
Itoa
(
i
))
...
...
pkg/client/record/events_cache_test.go
View file @
08d9e244
...
@@ -34,7 +34,7 @@ func TestAddOrUpdateEventNoExisting(t *testing.T) {
...
@@ -34,7 +34,7 @@ func TestAddOrUpdateEventNoExisting(t *testing.T) {
Name
:
"awesome.name"
,
Name
:
"awesome.name"
,
Namespace
:
"betterNamespace"
,
Namespace
:
"betterNamespace"
,
UID
:
"C934D34AFB20242"
,
UID
:
"C934D34AFB20242"
,
APIVersion
:
"v
1beta1
"
,
APIVersion
:
"v
ersion
"
,
},
},
Source
:
api
.
EventSource
{
Source
:
api
.
EventSource
{
Component
:
"kubelet"
,
Component
:
"kubelet"
,
...
@@ -148,7 +148,7 @@ func TestGetEventExisting(t *testing.T) {
...
@@ -148,7 +148,7 @@ func TestGetEventExisting(t *testing.T) {
Name
:
"clever.name.here"
,
Name
:
"clever.name.here"
,
Namespace
:
"spaceOfName"
,
Namespace
:
"spaceOfName"
,
UID
:
"D933D32AFB2A238"
,
UID
:
"D933D32AFB2A238"
,
APIVersion
:
"v
1beta1
"
,
APIVersion
:
"v
ersion
"
,
},
},
Source
:
api
.
EventSource
{
Source
:
api
.
EventSource
{
Component
:
"kubelet"
,
Component
:
"kubelet"
,
...
...
pkg/kubectl/kubectl.go
View file @
08d9e244
...
@@ -25,8 +25,6 @@ import (
...
@@ -25,8 +25,6 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
)
)
var
apiVersionToUse
=
"v1beta1"
const
kubectlAnnotationPrefix
=
"kubectl.kubernetes.io/"
const
kubectlAnnotationPrefix
=
"kubectl.kubernetes.io/"
type
NamespaceInfo
struct
{
type
NamespaceInfo
struct
{
...
...
pkg/tools/etcd_helper_test.go
View file @
08d9e244
...
@@ -47,8 +47,8 @@ var codec runtime.Codec
...
@@ -47,8 +47,8 @@ var codec runtime.Codec
func
init
()
{
func
init
()
{
scheme
=
runtime
.
NewScheme
()
scheme
=
runtime
.
NewScheme
()
scheme
.
AddKnownTypes
(
""
,
&
TestResource
{})
scheme
.
AddKnownTypes
(
""
,
&
TestResource
{})
scheme
.
AddKnownTypes
(
"v1beta1"
,
&
TestResource
{})
scheme
.
AddKnownTypes
(
testapi
.
Version
()
,
&
TestResource
{})
codec
=
runtime
.
CodecFor
(
scheme
,
"v1beta1"
)
codec
=
runtime
.
CodecFor
(
scheme
,
testapi
.
Version
()
)
scheme
.
AddConversionFuncs
(
scheme
.
AddConversionFuncs
(
func
(
in
*
TestResource
,
out
*
TestResource
,
s
conversion
.
Scope
)
error
{
func
(
in
*
TestResource
,
out
*
TestResource
,
s
conversion
.
Scope
)
error
{
*
out
=
*
in
*
out
=
*
in
...
@@ -69,6 +69,14 @@ func TestIsEtcdNotFound(t *testing.T) {
...
@@ -69,6 +69,14 @@ func TestIsEtcdNotFound(t *testing.T) {
try
(
fmt
.
Errorf
(
"some other kind of error"
),
false
)
try
(
fmt
.
Errorf
(
"some other kind of error"
),
false
)
}
}
// Returns an encoded version of api.Pod with the given name.
func
getEncodedPod
(
name
string
)
string
{
pod
,
_
:=
testapi
.
Codec
()
.
Encode
(
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
name
},
})
return
string
(
pod
)
}
func
TestExtractToList
(
t
*
testing
.
T
)
{
func
TestExtractToList
(
t
*
testing
.
T
)
{
fakeClient
:=
NewFakeEtcdClient
(
t
)
fakeClient
:=
NewFakeEtcdClient
(
t
)
fakeClient
.
Data
[
"/some/key"
]
=
EtcdResponseWithError
{
fakeClient
.
Data
[
"/some/key"
]
=
EtcdResponseWithError
{
...
@@ -79,19 +87,19 @@ func TestExtractToList(t *testing.T) {
...
@@ -79,19 +87,19 @@ func TestExtractToList(t *testing.T) {
Nodes
:
[]
*
etcd
.
Node
{
Nodes
:
[]
*
etcd
.
Node
{
{
{
Key
:
"/foo"
,
Key
:
"/foo"
,
Value
:
`{"id":"foo","kind":"Pod","apiVersion":"v1beta1"}`
,
Value
:
getEncodedPod
(
"foo"
)
,
Dir
:
false
,
Dir
:
false
,
ModifiedIndex
:
1
,
ModifiedIndex
:
1
,
},
},
{
{
Key
:
"/bar"
,
Key
:
"/bar"
,
Value
:
`{"id":"bar","kind":"Pod","apiVersion":"v1beta1"}`
,
Value
:
getEncodedPod
(
"bar"
)
,
Dir
:
false
,
Dir
:
false
,
ModifiedIndex
:
2
,
ModifiedIndex
:
2
,
},
},
{
{
Key
:
"/baz"
,
Key
:
"/baz"
,
Value
:
`{"id":"baz","kind":"Pod","apiVersion":"v1beta1"}`
,
Value
:
getEncodedPod
(
"baz"
)
,
Dir
:
false
,
Dir
:
false
,
ModifiedIndex
:
3
,
ModifiedIndex
:
3
,
},
},
...
@@ -153,13 +161,13 @@ func TestExtractToListAcrossDirectories(t *testing.T) {
...
@@ -153,13 +161,13 @@ func TestExtractToListAcrossDirectories(t *testing.T) {
Nodes
:
[]
*
etcd
.
Node
{
Nodes
:
[]
*
etcd
.
Node
{
{
{
Key
:
"/foo"
,
Key
:
"/foo"
,
Value
:
`{"id":"foo","kind":"Pod","apiVersion":"v1beta1"}`
,
Value
:
getEncodedPod
(
"foo"
)
,
Dir
:
false
,
Dir
:
false
,
ModifiedIndex
:
1
,
ModifiedIndex
:
1
,
},
},
{
{
Key
:
"/baz"
,
Key
:
"/baz"
,
Value
:
`{"id":"baz","kind":"Pod","apiVersion":"v1beta1"}`
,
Value
:
getEncodedPod
(
"baz"
)
,
Dir
:
false
,
Dir
:
false
,
ModifiedIndex
:
1
,
ModifiedIndex
:
1
,
},
},
...
@@ -172,7 +180,7 @@ func TestExtractToListAcrossDirectories(t *testing.T) {
...
@@ -172,7 +180,7 @@ func TestExtractToListAcrossDirectories(t *testing.T) {
Nodes
:
[]
*
etcd
.
Node
{
Nodes
:
[]
*
etcd
.
Node
{
{
{
Key
:
"/bar"
,
Key
:
"/bar"
,
Value
:
`{"id":"bar","kind":"Pod","apiVersion":"v1beta1"}`
,
Value
:
getEncodedPod
(
"bar"
)
,
ModifiedIndex
:
2
,
ModifiedIndex
:
2
,
},
},
},
},
...
@@ -230,17 +238,17 @@ func TestExtractToListExcludesDirectories(t *testing.T) {
...
@@ -230,17 +238,17 @@ func TestExtractToListExcludesDirectories(t *testing.T) {
Nodes
:
[]
*
etcd
.
Node
{
Nodes
:
[]
*
etcd
.
Node
{
{
{
Key
:
"/foo"
,
Key
:
"/foo"
,
Value
:
`{"id":"foo","kind":"Pod","apiVersion":"v1beta1"}`
,
Value
:
getEncodedPod
(
"foo"
)
,
ModifiedIndex
:
1
,
ModifiedIndex
:
1
,
},
},
{
{
Key
:
"/bar"
,
Key
:
"/bar"
,
Value
:
`{"id":"bar","kind":"Pod","apiVersion":"v1beta1"}`
,
Value
:
getEncodedPod
(
"bar"
)
,
ModifiedIndex
:
2
,
ModifiedIndex
:
2
,
},
},
{
{
Key
:
"/baz"
,
Key
:
"/baz"
,
Value
:
`{"id":"baz","kind":"Pod","apiVersion":"v1beta1"}`
,
Value
:
getEncodedPod
(
"baz"
)
,
ModifiedIndex
:
3
,
ModifiedIndex
:
3
,
},
},
{
{
...
...
pkg/watch/json/encoder_test.go
View file @
08d9e244
...
@@ -22,8 +22,7 @@ import (
...
@@ -22,8 +22,7 @@ import (
"testing"
"testing"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1beta1"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/testapi"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1beta2"
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
"github.com/GoogleCloudPlatform/kubernetes/pkg/watch"
"github.com/GoogleCloudPlatform/kubernetes/pkg/watch"
)
)
...
@@ -37,17 +36,17 @@ func TestEncodeDecodeRoundTrip(t *testing.T) {
...
@@ -37,17 +36,17 @@ func TestEncodeDecodeRoundTrip(t *testing.T) {
{
{
watch
.
Added
,
watch
.
Added
,
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo"
}},
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo"
}},
v1beta1
.
Codec
,
testapi
.
Codec
()
,
},
},
{
{
watch
.
Modified
,
watch
.
Modified
,
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo"
}},
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo"
}},
v1beta2
.
Codec
,
testapi
.
Codec
()
,
},
},
{
{
watch
.
Deleted
,
watch
.
Deleted
,
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo"
}},
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo"
}},
api
.
Codec
,
testapi
.
Codec
()
,
},
},
}
}
for
i
,
testCase
:=
range
testCases
{
for
i
,
testCase
:=
range
testCases
{
...
...
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