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
656fa7be
Commit
656fa7be
authored
Jun 03, 2015
by
Brian Grant
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9225 from caesarxuchao/add-v1-tests-general
Add v1 tests
parents
c92b4255
ca72165b
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
78 additions
and
254 deletions
+78
-254
conversion_test.go
pkg/api/conversion_test.go
+0
-1
testapi_test.go
pkg/api/testapi/testapi_test.go
+22
-22
api_installer_test.go
pkg/apiserver/api_installer_test.go
+2
-2
limit_ranges_test.go
pkg/client/limit_ranges_test.go
+0
-3
nodes_test.go
pkg/client/nodes_test.go
+0
-3
persistentvolume_test.go
pkg/client/persistentvolume_test.go
+0
-3
persistentvolumeclaim_test.go
pkg/client/persistentvolumeclaim_test.go
+0
-3
pod_templates_test.go
pkg/client/pod_templates_test.go
+0
-24
events_cache_test.go
pkg/client/record/events_cache_test.go
+3
-3
replication_controllers_test.go
pkg/client/replication_controllers_test.go
+0
-3
resource_quotas_test.go
pkg/client/resource_quotas_test.go
+0
-3
replication_controller_test.go
pkg/controller/replication_controller_test.go
+1
-4
expose_test.go
pkg/kubectl/cmd/expose_test.go
+4
-4
factory_test.go
pkg/kubectl/cmd/util/factory_test.go
+3
-3
resource_printer_test.go
pkg/kubectl/resource_printer_test.go
+1
-14
common_test.go
pkg/kubelet/config/common_test.go
+39
-39
file_test.go
pkg/kubelet/config/file_test.go
+0
-120
helper_test.go
pkg/runtime/helper_test.go
+1
-0
unstructured_test.go
pkg/runtime/unstructured_test.go
+2
-0
No files found.
pkg/api/conversion_test.go
View file @
656fa7be
...
@@ -22,7 +22,6 @@ import (
...
@@ -22,7 +22,6 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/testapi"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/testapi"
_
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1beta3"
)
)
func
BenchmarkPodConversion
(
b
*
testing
.
B
)
{
func
BenchmarkPodConversion
(
b
*
testing
.
B
)
{
...
...
pkg/api/testapi/testapi_test.go
View file @
656fa7be
...
@@ -46,9 +46,9 @@ func TestResourcePathWithPrefixForV1Beta3(t *testing.T) {
...
@@ -46,9 +46,9 @@ func TestResourcePathWithPrefixForV1Beta3(t *testing.T) {
}
}
}
}
func
TestResourcePathWithPrefixForV1
Beta1
(
t
*
testing
.
T
)
{
func
TestResourcePathWithPrefixForV1
(
t
*
testing
.
T
)
{
if
Version
()
!=
"v1
beta1
"
{
if
Version
()
!=
"v1"
{
// Skip the test if we are not testing v1
beta1
.
// Skip the test if we are not testing v1.
return
return
}
}
...
@@ -59,11 +59,11 @@ func TestResourcePathWithPrefixForV1Beta1(t *testing.T) {
...
@@ -59,11 +59,11 @@ func TestResourcePathWithPrefixForV1Beta1(t *testing.T) {
name
string
name
string
expected
string
expected
string
}{
}{
{
"prefix"
,
"resource"
,
"mynamespace"
,
"myresource"
,
"/api/v1
beta1/prefix
/resource/myresource"
},
{
"prefix"
,
"resource"
,
"mynamespace"
,
"myresource"
,
"/api/v1
/prefix/namespaces/mynamespace
/resource/myresource"
},
{
"prefix"
,
"resource"
,
""
,
"myresource"
,
"/api/v1
beta1
/prefix/resource/myresource"
},
{
"prefix"
,
"resource"
,
""
,
"myresource"
,
"/api/v1/prefix/resource/myresource"
},
{
"prefix"
,
"resource"
,
"mynamespace"
,
""
,
"/api/v1
beta1/prefix
/resource"
},
{
"prefix"
,
"resource"
,
"mynamespace"
,
""
,
"/api/v1
/prefix/namespaces/mynamespace
/resource"
},
{
"prefix"
,
"resource"
,
""
,
""
,
"/api/v1
beta1
/prefix/resource"
},
{
"prefix"
,
"resource"
,
""
,
""
,
"/api/v1/prefix/resource"
},
{
""
,
"resource"
,
"mynamespace"
,
"myresource"
,
"/api/v1
beta1
/resource/myresource"
},
{
""
,
"resource"
,
"mynamespace"
,
"myresource"
,
"/api/v1
/namespaces/mynamespace
/resource/myresource"
},
}
}
for
_
,
item
:=
range
testCases
{
for
_
,
item
:=
range
testCases
{
if
actual
:=
ResourcePathWithPrefix
(
item
.
prefix
,
item
.
resource
,
item
.
namespace
,
item
.
name
);
actual
!=
item
.
expected
{
if
actual
:=
ResourcePathWithPrefix
(
item
.
prefix
,
item
.
resource
,
item
.
namespace
,
item
.
name
);
actual
!=
item
.
expected
{
...
@@ -96,9 +96,9 @@ func TestResourcePathForV1Beta3(t *testing.T) {
...
@@ -96,9 +96,9 @@ func TestResourcePathForV1Beta3(t *testing.T) {
}
}
}
}
func
TestResourcePathForV1
Beta1
(
t
*
testing
.
T
)
{
func
TestResourcePathForV1
(
t
*
testing
.
T
)
{
if
Version
()
!=
"v1
beta1
"
{
if
Version
()
!=
"v1"
{
// Skip the test if we are not testing v1
beta1
.
// Skip the test if we are not testing v1.
return
return
}
}
...
@@ -108,10 +108,10 @@ func TestResourcePathForV1Beta1(t *testing.T) {
...
@@ -108,10 +108,10 @@ func TestResourcePathForV1Beta1(t *testing.T) {
name
string
name
string
expected
string
expected
string
}{
}{
{
"resource"
,
"mynamespace"
,
"myresource"
,
"/api/v1
beta1
/resource/myresource"
},
{
"resource"
,
"mynamespace"
,
"myresource"
,
"/api/v1
/namespaces/mynamespace
/resource/myresource"
},
{
"resource"
,
""
,
"myresource"
,
"/api/v1
beta1
/resource/myresource"
},
{
"resource"
,
""
,
"myresource"
,
"/api/v1/resource/myresource"
},
{
"resource"
,
"mynamespace"
,
""
,
"/api/v1
beta1
/resource"
},
{
"resource"
,
"mynamespace"
,
""
,
"/api/v1
/namespaces/mynamespace
/resource"
},
{
"resource"
,
""
,
""
,
"/api/v1
beta1
/resource"
},
{
"resource"
,
""
,
""
,
"/api/v1/resource"
},
}
}
for
_
,
item
:=
range
testCases
{
for
_
,
item
:=
range
testCases
{
if
actual
:=
ResourcePath
(
item
.
resource
,
item
.
namespace
,
item
.
name
);
actual
!=
item
.
expected
{
if
actual
:=
ResourcePath
(
item
.
resource
,
item
.
namespace
,
item
.
name
);
actual
!=
item
.
expected
{
...
@@ -144,9 +144,9 @@ func TestResourcePathWithNamespaceQueryForV1Beta3(t *testing.T) {
...
@@ -144,9 +144,9 @@ func TestResourcePathWithNamespaceQueryForV1Beta3(t *testing.T) {
}
}
}
}
func
TestResourcePathWithNamespaceQueryForV1
Beta1
(
t
*
testing
.
T
)
{
func
TestResourcePathWithNamespaceQueryForV1
(
t
*
testing
.
T
)
{
if
Version
()
!=
"v1
beta1
"
{
if
Version
()
!=
"v1"
{
// Skip the test if we are not testing v1
beta1
.
// Skip the test if we are not testing v1.
return
return
}
}
...
@@ -156,10 +156,10 @@ func TestResourcePathWithNamespaceQueryForV1Beta1(t *testing.T) {
...
@@ -156,10 +156,10 @@ func TestResourcePathWithNamespaceQueryForV1Beta1(t *testing.T) {
name
string
name
string
expected
string
expected
string
}{
}{
{
"resource"
,
"mynamespace"
,
"myresource"
,
"/api/v1
beta1/resource/myresource?namespace=mynamespa
ce"
},
{
"resource"
,
"mynamespace"
,
"myresource"
,
"/api/v1
/namespaces/mynamespace/resource/myresour
ce"
},
{
"resource"
,
""
,
"myresource"
,
"/api/v1
beta1
/resource/myresource"
},
{
"resource"
,
""
,
"myresource"
,
"/api/v1/resource/myresource"
},
{
"resource"
,
"mynamespace"
,
""
,
"/api/v1
beta1/resource?namespace=mynamespa
ce"
},
{
"resource"
,
"mynamespace"
,
""
,
"/api/v1
/namespaces/mynamespace/resour
ce"
},
{
"resource"
,
""
,
""
,
"/api/v1
beta1
/resource"
},
{
"resource"
,
""
,
""
,
"/api/v1/resource"
},
}
}
for
_
,
item
:=
range
testCases
{
for
_
,
item
:=
range
testCases
{
if
actual
:=
ResourcePathWithNamespaceQuery
(
item
.
resource
,
item
.
namespace
,
item
.
name
);
actual
!=
item
.
expected
{
if
actual
:=
ResourcePathWithNamespaceQuery
(
item
.
resource
,
item
.
namespace
,
item
.
name
);
actual
!=
item
.
expected
{
...
...
pkg/apiserver/api_installer_test.go
View file @
656fa7be
...
@@ -28,14 +28,14 @@ import (
...
@@ -28,14 +28,14 @@ import (
func
TestScopeNamingGenerateLink
(
t
*
testing
.
T
)
{
func
TestScopeNamingGenerateLink
(
t
*
testing
.
T
)
{
selfLinker
:=
&
setTestSelfLinker
{
selfLinker
:=
&
setTestSelfLinker
{
t
:
t
,
t
:
t
,
expectedSet
:
"/api/v1
beta3
/namespaces/other/services/foo"
,
expectedSet
:
"/api/v1/namespaces/other/services/foo"
,
name
:
"foo"
,
name
:
"foo"
,
namespace
:
"other"
,
namespace
:
"other"
,
}
}
s
:=
scopeNaming
{
s
:=
scopeNaming
{
meta
.
RESTScopeNamespace
,
meta
.
RESTScopeNamespace
,
selfLinker
,
selfLinker
,
"/api/v1
beta3
/namespaces/{namespace}/services/{name}"
,
"/api/v1/namespaces/{namespace}/services/{name}"
,
true
,
true
,
}
}
service
:=
&
api
.
Service
{
service
:=
&
api
.
Service
{
...
...
pkg/client/limit_ranges_test.go
View file @
656fa7be
...
@@ -28,9 +28,6 @@ import (
...
@@ -28,9 +28,6 @@ import (
)
)
func
getLimitRangesResourceName
()
string
{
func
getLimitRangesResourceName
()
string
{
if
api
.
PreV1Beta3
(
testapi
.
Version
())
{
return
"limitRanges"
}
return
"limitranges"
return
"limitranges"
}
}
...
...
pkg/client/nodes_test.go
View file @
656fa7be
...
@@ -28,9 +28,6 @@ import (
...
@@ -28,9 +28,6 @@ import (
)
)
func
getNodesResourceName
()
string
{
func
getNodesResourceName
()
string
{
if
api
.
PreV1Beta3
(
testapi
.
Version
())
{
return
"minions"
}
return
"nodes"
return
"nodes"
}
}
...
...
pkg/client/persistentvolume_test.go
View file @
656fa7be
...
@@ -28,9 +28,6 @@ import (
...
@@ -28,9 +28,6 @@ import (
)
)
func
getPersistentVolumesResoureName
()
string
{
func
getPersistentVolumesResoureName
()
string
{
if
api
.
PreV1Beta3
(
testapi
.
Version
())
{
return
"persistentVolumes"
}
return
"persistentvolumes"
return
"persistentvolumes"
}
}
...
...
pkg/client/persistentvolumeclaim_test.go
View file @
656fa7be
...
@@ -28,9 +28,6 @@ import (
...
@@ -28,9 +28,6 @@ import (
)
)
func
getPersistentVolumeClaimsResoureName
()
string
{
func
getPersistentVolumeClaimsResoureName
()
string
{
if
api
.
PreV1Beta3
(
testapi
.
Version
())
{
return
"persistentVolumeClaims"
}
return
"persistentvolumeclaims"
return
"persistentvolumeclaims"
}
}
...
...
pkg/client/pod_templates_test.go
View file @
656fa7be
...
@@ -31,10 +31,6 @@ func getPodTemplatesResoureName() string {
...
@@ -31,10 +31,6 @@ func getPodTemplatesResoureName() string {
}
}
func
TestPodTemplateCreate
(
t
*
testing
.
T
)
{
func
TestPodTemplateCreate
(
t
*
testing
.
T
)
{
if
api
.
PreV1Beta3
(
testapi
.
Version
())
{
return
}
ns
:=
api
.
NamespaceDefault
ns
:=
api
.
NamespaceDefault
podTemplate
:=
api
.
PodTemplate
{
podTemplate
:=
api
.
PodTemplate
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
...
@@ -58,10 +54,6 @@ func TestPodTemplateCreate(t *testing.T) {
...
@@ -58,10 +54,6 @@ func TestPodTemplateCreate(t *testing.T) {
}
}
func
TestPodTemplateGet
(
t
*
testing
.
T
)
{
func
TestPodTemplateGet
(
t
*
testing
.
T
)
{
if
api
.
PreV1Beta3
(
testapi
.
Version
())
{
return
}
ns
:=
api
.
NamespaceDefault
ns
:=
api
.
NamespaceDefault
podTemplate
:=
&
api
.
PodTemplate
{
podTemplate
:=
&
api
.
PodTemplate
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
...
@@ -85,10 +77,6 @@ func TestPodTemplateGet(t *testing.T) {
...
@@ -85,10 +77,6 @@ func TestPodTemplateGet(t *testing.T) {
}
}
func
TestPodTemplateList
(
t
*
testing
.
T
)
{
func
TestPodTemplateList
(
t
*
testing
.
T
)
{
if
api
.
PreV1Beta3
(
testapi
.
Version
())
{
return
}
ns
:=
api
.
NamespaceDefault
ns
:=
api
.
NamespaceDefault
podTemplateList
:=
&
api
.
PodTemplateList
{
podTemplateList
:=
&
api
.
PodTemplateList
{
Items
:
[]
api
.
PodTemplate
{
Items
:
[]
api
.
PodTemplate
{
...
@@ -114,10 +102,6 @@ func TestPodTemplateList(t *testing.T) {
...
@@ -114,10 +102,6 @@ func TestPodTemplateList(t *testing.T) {
}
}
func
TestPodTemplateUpdate
(
t
*
testing
.
T
)
{
func
TestPodTemplateUpdate
(
t
*
testing
.
T
)
{
if
api
.
PreV1Beta3
(
testapi
.
Version
())
{
return
}
ns
:=
api
.
NamespaceDefault
ns
:=
api
.
NamespaceDefault
podTemplate
:=
&
api
.
PodTemplate
{
podTemplate
:=
&
api
.
PodTemplate
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
...
@@ -136,10 +120,6 @@ func TestPodTemplateUpdate(t *testing.T) {
...
@@ -136,10 +120,6 @@ func TestPodTemplateUpdate(t *testing.T) {
}
}
func
TestPodTemplateDelete
(
t
*
testing
.
T
)
{
func
TestPodTemplateDelete
(
t
*
testing
.
T
)
{
if
api
.
PreV1Beta3
(
testapi
.
Version
())
{
return
}
ns
:=
api
.
NamespaceDefault
ns
:=
api
.
NamespaceDefault
c
:=
&
testClient
{
c
:=
&
testClient
{
Request
:
testRequest
{
Method
:
"DELETE"
,
Path
:
testapi
.
ResourcePath
(
getPodTemplatesResoureName
(),
ns
,
"foo"
),
Query
:
buildQueryValues
(
ns
,
nil
)},
Request
:
testRequest
{
Method
:
"DELETE"
,
Path
:
testapi
.
ResourcePath
(
getPodTemplatesResoureName
(),
ns
,
"foo"
),
Query
:
buildQueryValues
(
ns
,
nil
)},
...
@@ -150,10 +130,6 @@ func TestPodTemplateDelete(t *testing.T) {
...
@@ -150,10 +130,6 @@ func TestPodTemplateDelete(t *testing.T) {
}
}
func
TestPodTemplateWatch
(
t
*
testing
.
T
)
{
func
TestPodTemplateWatch
(
t
*
testing
.
T
)
{
if
api
.
PreV1Beta3
(
testapi
.
Version
())
{
return
}
c
:=
&
testClient
{
c
:=
&
testClient
{
Request
:
testRequest
{
Request
:
testRequest
{
Method
:
"GET"
,
Method
:
"GET"
,
...
...
pkg/client/record/events_cache_test.go
View file @
656fa7be
...
@@ -67,7 +67,7 @@ func TestAddOrUpdateEventExisting(t *testing.T) {
...
@@ -67,7 +67,7 @@ func TestAddOrUpdateEventExisting(t *testing.T) {
Name
:
"anOkName"
,
Name
:
"anOkName"
,
Namespace
:
"someNamespace"
,
Namespace
:
"someNamespace"
,
UID
:
"C934D3234CD0242"
,
UID
:
"C934D3234CD0242"
,
APIVersion
:
"v
1beta2
"
,
APIVersion
:
"v
ersion
"
,
},
},
Source
:
api
.
EventSource
{
Source
:
api
.
EventSource
{
Component
:
"kubelet"
,
Component
:
"kubelet"
,
...
@@ -88,7 +88,7 @@ func TestAddOrUpdateEventExisting(t *testing.T) {
...
@@ -88,7 +88,7 @@ func TestAddOrUpdateEventExisting(t *testing.T) {
Name
:
"anOkName"
,
Name
:
"anOkName"
,
Namespace
:
"someNamespace"
,
Namespace
:
"someNamespace"
,
UID
:
"C934D3234CD0242"
,
UID
:
"C934D3234CD0242"
,
APIVersion
:
"v
1beta2
"
,
APIVersion
:
"v
ersion
"
,
},
},
Source
:
api
.
EventSource
{
Source
:
api
.
EventSource
{
Component
:
"kubelet"
,
Component
:
"kubelet"
,
...
@@ -119,7 +119,7 @@ func TestGetEventNoExisting(t *testing.T) {
...
@@ -119,7 +119,7 @@ func TestGetEventNoExisting(t *testing.T) {
Name
:
"iAmAController"
,
Name
:
"iAmAController"
,
Namespace
:
"IHaveANamespace"
,
Namespace
:
"IHaveANamespace"
,
UID
:
"9039D34AFBCDA42"
,
UID
:
"9039D34AFBCDA42"
,
APIVersion
:
"v
1beta3
"
,
APIVersion
:
"v
ersion
"
,
},
},
Source
:
api
.
EventSource
{
Source
:
api
.
EventSource
{
Component
:
"kubelet"
,
Component
:
"kubelet"
,
...
...
pkg/client/replication_controllers_test.go
View file @
656fa7be
...
@@ -25,9 +25,6 @@ import (
...
@@ -25,9 +25,6 @@ import (
)
)
func
getRCResourceName
()
string
{
func
getRCResourceName
()
string
{
if
api
.
PreV1Beta3
(
testapi
.
Version
())
{
return
"replicationControllers"
}
return
"replicationcontrollers"
return
"replicationcontrollers"
}
}
...
...
pkg/client/resource_quotas_test.go
View file @
656fa7be
...
@@ -28,9 +28,6 @@ import (
...
@@ -28,9 +28,6 @@ import (
)
)
func
getResourceQuotasResoureName
()
string
{
func
getResourceQuotasResoureName
()
string
{
if
api
.
PreV1Beta3
(
testapi
.
Version
())
{
return
"resourceQuotas"
}
return
"resourcequotas"
return
"resourcequotas"
}
}
...
...
pkg/controller/replication_controller_test.go
View file @
656fa7be
...
@@ -166,9 +166,6 @@ func validateSyncReplication(t *testing.T, fakePodControl *FakePodControl, expec
...
@@ -166,9 +166,6 @@ func validateSyncReplication(t *testing.T, fakePodControl *FakePodControl, expec
}
}
func
replicationControllerResourceName
()
string
{
func
replicationControllerResourceName
()
string
{
if
api
.
PreV1Beta3
(
testapi
.
Version
())
{
return
"replicationControllers"
}
return
"replicationcontrollers"
return
"replicationcontrollers"
}
}
...
@@ -193,7 +190,7 @@ func makeTestServer(t *testing.T, namespace, name string, podResponse, controlle
...
@@ -193,7 +190,7 @@ func makeTestServer(t *testing.T, namespace, name string, podResponse, controlle
mux
:=
http
.
NewServeMux
()
mux
:=
http
.
NewServeMux
()
mux
.
Handle
(
testapi
.
ResourcePath
(
"pods"
,
namespace
,
""
),
&
fakePodHandler
)
mux
.
Handle
(
testapi
.
ResourcePath
(
"pods"
,
namespace
,
""
),
&
fakePodHandler
)
mux
.
Handle
(
testapi
.
ResourcePath
(
replicationControllerResourceName
(),
""
,
""
),
&
fakeControllerHandler
)
mux
.
Handle
(
testapi
.
ResourcePath
(
replicationControllerResourceName
(),
""
,
""
),
&
fakeControllerHandler
)
if
!
api
.
PreV1Beta3
(
testapi
.
Version
())
&&
namespace
!=
""
{
if
namespace
!=
""
{
mux
.
Handle
(
testapi
.
ResourcePath
(
replicationControllerResourceName
(),
namespace
,
""
),
&
fakeControllerHandler
)
mux
.
Handle
(
testapi
.
ResourcePath
(
replicationControllerResourceName
(),
namespace
,
""
),
&
fakeControllerHandler
)
}
}
if
name
!=
""
{
if
name
!=
""
{
...
...
pkg/kubectl/cmd/expose_test.go
View file @
656fa7be
...
@@ -49,7 +49,7 @@ func TestRunExposeService(t *testing.T) {
...
@@ -49,7 +49,7 @@ func TestRunExposeService(t *testing.T) {
},
},
input
:
&
api
.
Service
{
input
:
&
api
.
Service
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"baz"
,
Namespace
:
"test"
,
ResourceVersion
:
"12"
},
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"baz"
,
Namespace
:
"test"
,
ResourceVersion
:
"12"
},
TypeMeta
:
api
.
TypeMeta
{
Kind
:
"Service"
,
APIVersion
:
"v1
beta3
"
},
TypeMeta
:
api
.
TypeMeta
{
Kind
:
"Service"
,
APIVersion
:
"v1"
},
Spec
:
api
.
ServiceSpec
{
Spec
:
api
.
ServiceSpec
{
Selector
:
map
[
string
]
string
{
"app"
:
"go"
},
Selector
:
map
[
string
]
string
{
"app"
:
"go"
},
},
},
...
@@ -57,7 +57,7 @@ func TestRunExposeService(t *testing.T) {
...
@@ -57,7 +57,7 @@ func TestRunExposeService(t *testing.T) {
flags
:
map
[
string
]
string
{
"selector"
:
"func=stream"
,
"protocol"
:
"UDP"
,
"port"
:
"14"
,
"name"
:
"foo"
,
"labels"
:
"svc=test"
},
flags
:
map
[
string
]
string
{
"selector"
:
"func=stream"
,
"protocol"
:
"UDP"
,
"port"
:
"14"
,
"name"
:
"foo"
,
"labels"
:
"svc=test"
},
output
:
&
api
.
Service
{
output
:
&
api
.
Service
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo"
,
Namespace
:
"test"
,
ResourceVersion
:
"12"
,
Labels
:
map
[
string
]
string
{
"svc"
:
"test"
}},
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo"
,
Namespace
:
"test"
,
ResourceVersion
:
"12"
,
Labels
:
map
[
string
]
string
{
"svc"
:
"test"
}},
TypeMeta
:
api
.
TypeMeta
{
Kind
:
"Service"
,
APIVersion
:
"v1
beta3
"
},
TypeMeta
:
api
.
TypeMeta
{
Kind
:
"Service"
,
APIVersion
:
"v1"
},
Spec
:
api
.
ServiceSpec
{
Spec
:
api
.
ServiceSpec
{
Ports
:
[]
api
.
ServicePort
{
Ports
:
[]
api
.
ServicePort
{
{
{
...
@@ -82,7 +82,7 @@ func TestRunExposeService(t *testing.T) {
...
@@ -82,7 +82,7 @@ func TestRunExposeService(t *testing.T) {
},
},
input
:
&
api
.
Service
{
input
:
&
api
.
Service
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"mayor"
,
Namespace
:
"default"
,
ResourceVersion
:
"12"
},
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"mayor"
,
Namespace
:
"default"
,
ResourceVersion
:
"12"
},
TypeMeta
:
api
.
TypeMeta
{
Kind
:
"Service"
,
APIVersion
:
"v1
beta3
"
},
TypeMeta
:
api
.
TypeMeta
{
Kind
:
"Service"
,
APIVersion
:
"v1"
},
Spec
:
api
.
ServiceSpec
{
Spec
:
api
.
ServiceSpec
{
Selector
:
map
[
string
]
string
{
"run"
:
"this"
},
Selector
:
map
[
string
]
string
{
"run"
:
"this"
},
},
},
...
@@ -91,7 +91,7 @@ func TestRunExposeService(t *testing.T) {
...
@@ -91,7 +91,7 @@ func TestRunExposeService(t *testing.T) {
flags
:
map
[
string
]
string
{
"selector"
:
"run=this"
,
"port"
:
"80"
,
"labels"
:
"runas=amayor"
},
flags
:
map
[
string
]
string
{
"selector"
:
"run=this"
,
"port"
:
"80"
,
"labels"
:
"runas=amayor"
},
output
:
&
api
.
Service
{
output
:
&
api
.
Service
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"mayor"
,
Namespace
:
"default"
,
ResourceVersion
:
"12"
,
Labels
:
map
[
string
]
string
{
"runas"
:
"amayor"
}},
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"mayor"
,
Namespace
:
"default"
,
ResourceVersion
:
"12"
,
Labels
:
map
[
string
]
string
{
"runas"
:
"amayor"
}},
TypeMeta
:
api
.
TypeMeta
{
Kind
:
"Service"
,
APIVersion
:
"v1
beta3
"
},
TypeMeta
:
api
.
TypeMeta
{
Kind
:
"Service"
,
APIVersion
:
"v1"
},
Spec
:
api
.
ServiceSpec
{
Spec
:
api
.
ServiceSpec
{
Ports
:
[]
api
.
ServicePort
{
Ports
:
[]
api
.
ServicePort
{
{
{
...
...
pkg/kubectl/cmd/util/factory_test.go
View file @
656fa7be
...
@@ -117,7 +117,7 @@ func TestLabelsForObject(t *testing.T) {
...
@@ -117,7 +117,7 @@ func TestLabelsForObject(t *testing.T) {
name
:
"successful re-use of labels"
,
name
:
"successful re-use of labels"
,
object
:
&
api
.
Service
{
object
:
&
api
.
Service
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"baz"
,
Namespace
:
"test"
,
Labels
:
map
[
string
]
string
{
"svc"
:
"test"
}},
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"baz"
,
Namespace
:
"test"
,
Labels
:
map
[
string
]
string
{
"svc"
:
"test"
}},
TypeMeta
:
api
.
TypeMeta
{
Kind
:
"Service"
,
APIVersion
:
"v1
beta3
"
},
TypeMeta
:
api
.
TypeMeta
{
Kind
:
"Service"
,
APIVersion
:
"v1"
},
},
},
expected
:
"svc=test"
,
expected
:
"svc=test"
,
err
:
nil
,
err
:
nil
,
...
@@ -126,7 +126,7 @@ func TestLabelsForObject(t *testing.T) {
...
@@ -126,7 +126,7 @@ func TestLabelsForObject(t *testing.T) {
name
:
"empty labels"
,
name
:
"empty labels"
,
object
:
&
api
.
Service
{
object
:
&
api
.
Service
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo"
,
Namespace
:
"test"
,
Labels
:
map
[
string
]
string
{}},
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo"
,
Namespace
:
"test"
,
Labels
:
map
[
string
]
string
{}},
TypeMeta
:
api
.
TypeMeta
{
Kind
:
"Service"
,
APIVersion
:
"v1
beta3
"
},
TypeMeta
:
api
.
TypeMeta
{
Kind
:
"Service"
,
APIVersion
:
"v1"
},
},
},
expected
:
""
,
expected
:
""
,
err
:
nil
,
err
:
nil
,
...
@@ -135,7 +135,7 @@ func TestLabelsForObject(t *testing.T) {
...
@@ -135,7 +135,7 @@ func TestLabelsForObject(t *testing.T) {
name
:
"nil labels"
,
name
:
"nil labels"
,
object
:
&
api
.
Service
{
object
:
&
api
.
Service
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"zen"
,
Namespace
:
"test"
,
Labels
:
nil
},
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"zen"
,
Namespace
:
"test"
,
Labels
:
nil
},
TypeMeta
:
api
.
TypeMeta
{
Kind
:
"Service"
,
APIVersion
:
"v1
beta3
"
},
TypeMeta
:
api
.
TypeMeta
{
Kind
:
"Service"
,
APIVersion
:
"v1"
},
},
},
expected
:
""
,
expected
:
""
,
err
:
nil
,
err
:
nil
,
...
...
pkg/kubectl/resource_printer_test.go
View file @
656fa7be
...
@@ -416,20 +416,7 @@ func TestTemplateStrings(t *testing.T) {
...
@@ -416,20 +416,7 @@ func TestTemplateStrings(t *testing.T) {
}
}
// The point of this test is to verify that the below template works. If you change this
// The point of this test is to verify that the below template works. If you change this
// template, you need to update hack/e2e-suite/update.sh.
// template, you need to update hack/e2e-suite/update.sh.
tmpl
:=
``
tmpl
:=
`{{if (exists . "status" "containerStatuses")}}{{range .status.containerStatuses}}{{if (and (eq .name "foo") (exists . "state" "running"))}}true{{end}}{{end}}{{end}}`
if
api
.
PreV1Beta3
(
testapi
.
Version
())
{
tmpl
=
`{{exists . "currentState" "info" "foo" "state" "running"}}`
useThisToDebug
:=
`
a: {{exists . "currentState"}}
b: {{exists . "currentState" "info"}}
c: {{exists . "currentState" "info" "foo"}}
d: {{exists . "currentState" "info" "foo" "state"}}
e: {{exists . "currentState" "info" "foo" "state" "running"}}
f: {{exists . "currentState" "info" "foo" "state" "running" "startedAt"}}`
_
=
useThisToDebug
// don't complain about unused var
}
else
{
tmpl
=
`{{if (exists . "status" "containerStatuses")}}{{range .status.containerStatuses}}{{if (and (eq .name "foo") (exists . "state" "running"))}}true{{end}}{{end}}{{end}}`
}
p
,
err
:=
NewTemplatePrinter
([]
byte
(
tmpl
))
p
,
err
:=
NewTemplatePrinter
([]
byte
(
tmpl
))
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatalf
(
"tmpl fail: %v"
,
err
)
t
.
Fatalf
(
"tmpl fail: %v"
,
err
)
...
...
pkg/kubelet/config/common_test.go
View file @
656fa7be
...
@@ -21,6 +21,7 @@ import (
...
@@ -21,6 +21,7 @@ import (
"testing"
"testing"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/registered"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/testapi"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/testapi"
"github.com/GoogleCloudPlatform/kubernetes/pkg/securitycontext"
"github.com/GoogleCloudPlatform/kubernetes/pkg/securitycontext"
...
@@ -56,11 +57,6 @@ func TestDecodeSinglePod(t *testing.T) {
...
@@ -56,11 +57,6 @@ func TestDecodeSinglePod(t *testing.T) {
t
.
Errorf
(
"unexpected error: %v"
,
err
)
t
.
Errorf
(
"unexpected error: %v"
,
err
)
}
}
parsed
,
podOut
,
err
:=
tryDecodeSinglePod
(
json
,
noDefault
)
parsed
,
podOut
,
err
:=
tryDecodeSinglePod
(
json
,
noDefault
)
if
testapi
.
Version
()
==
"v1beta1"
{
// v1beta1 conversion leaves empty lists that should be nil
podOut
.
Spec
.
Containers
[
0
]
.
Resources
.
Limits
=
nil
podOut
.
Spec
.
Containers
[
0
]
.
Resources
.
Requests
=
nil
}
if
!
parsed
{
if
!
parsed
{
t
.
Errorf
(
"expected to have parsed file: (%s)"
,
string
(
json
))
t
.
Errorf
(
"expected to have parsed file: (%s)"
,
string
(
json
))
}
}
...
@@ -71,24 +67,26 @@ func TestDecodeSinglePod(t *testing.T) {
...
@@ -71,24 +67,26 @@ func TestDecodeSinglePod(t *testing.T) {
t
.
Errorf
(
"expected:
\n
%#v
\n
got:
\n
%#v
\n
%s"
,
pod
,
podOut
,
string
(
json
))
t
.
Errorf
(
"expected:
\n
%#v
\n
got:
\n
%#v
\n
%s"
,
pod
,
podOut
,
string
(
json
))
}
}
externalPod
,
err
:=
testapi
.
Converter
()
.
ConvertToVersion
(
pod
,
"v1beta3"
)
for
_
,
version
:=
range
registered
.
RegisteredVersions
{
if
err
!=
nil
{
externalPod
,
err
:=
testapi
.
Converter
()
.
ConvertToVersion
(
pod
,
version
)
t
.
Errorf
(
"unexpected error: %v"
,
err
)
if
err
!=
nil
{
}
t
.
Errorf
(
"unexpected error: %v"
,
err
)
yaml
,
err
:=
yaml
.
Marshal
(
externalPod
)
}
if
err
!=
nil
{
yaml
,
err
:=
yaml
.
Marshal
(
externalPod
)
t
.
Errorf
(
"unexpected error: %v"
,
err
)
if
err
!=
nil
{
}
t
.
Errorf
(
"unexpected error: %v"
,
err
)
}
parsed
,
podOut
,
err
=
tryDecodeSinglePod
(
yaml
,
noDefault
)
parsed
,
podOut
,
err
=
tryDecodeSinglePod
(
yaml
,
noDefault
)
if
!
parsed
{
if
!
parsed
{
t
.
Errorf
(
"expected to have parsed file: (%s)"
,
string
(
yaml
))
t
.
Errorf
(
"expected to have parsed file: (%s)"
,
string
(
yaml
))
}
}
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"unexpected error: %v (%s)"
,
err
,
string
(
yaml
))
t
.
Errorf
(
"unexpected error: %v (%s)"
,
err
,
string
(
yaml
))
}
}
if
!
reflect
.
DeepEqual
(
pod
,
podOut
)
{
if
!
reflect
.
DeepEqual
(
pod
,
podOut
)
{
t
.
Errorf
(
"expected:
\n
%#v
\n
got:
\n
%#v
\n
%s"
,
pod
,
podOut
,
string
(
yaml
))
t
.
Errorf
(
"expected:
\n
%#v
\n
got:
\n
%#v
\n
%s"
,
pod
,
podOut
,
string
(
yaml
))
}
}
}
}
}
...
@@ -137,23 +135,25 @@ func TestDecodePodList(t *testing.T) {
...
@@ -137,23 +135,25 @@ func TestDecodePodList(t *testing.T) {
t
.
Errorf
(
"expected:
\n
%#v
\n
got:
\n
%#v
\n
%s"
,
podList
,
&
podListOut
,
string
(
json
))
t
.
Errorf
(
"expected:
\n
%#v
\n
got:
\n
%#v
\n
%s"
,
podList
,
&
podListOut
,
string
(
json
))
}
}
externalPodList
,
err
:=
testapi
.
Converter
()
.
ConvertToVersion
(
podList
,
"v1beta3"
)
for
_
,
version
:=
range
registered
.
RegisteredVersions
{
if
err
!=
nil
{
externalPodList
,
err
:=
testapi
.
Converter
()
.
ConvertToVersion
(
podList
,
version
)
t
.
Errorf
(
"unexpected error: %v"
,
err
)
if
err
!=
nil
{
}
t
.
Errorf
(
"unexpected error: %v"
,
err
)
yaml
,
err
:=
yaml
.
Marshal
(
externalPodList
)
}
if
err
!=
nil
{
yaml
,
err
:=
yaml
.
Marshal
(
externalPodList
)
t
.
Errorf
(
"unexpected error: %v"
,
err
)
if
err
!=
nil
{
}
t
.
Errorf
(
"unexpected error: %v"
,
err
)
}
parsed
,
podListOut
,
err
=
tryDecodePodList
(
yaml
,
noDefault
)
parsed
,
podListOut
,
err
=
tryDecodePodList
(
yaml
,
noDefault
)
if
!
parsed
{
if
!
parsed
{
t
.
Errorf
(
"expected to have parsed file: (%s)"
,
string
(
yaml
))
t
.
Errorf
(
"expected to have parsed file: (%s)"
,
string
(
yaml
))
}
}
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"unexpected error: %v (%s)"
,
err
,
string
(
yaml
))
t
.
Errorf
(
"unexpected error: %v (%s)"
,
err
,
string
(
yaml
))
}
}
if
!
reflect
.
DeepEqual
(
podList
,
&
podListOut
)
{
if
!
reflect
.
DeepEqual
(
podList
,
&
podListOut
)
{
t
.
Errorf
(
"expected:
\n
%#v
\n
got:
\n
%#v
\n
%s"
,
pod
,
&
podListOut
,
string
(
yaml
))
t
.
Errorf
(
"expected:
\n
%#v
\n
got:
\n
%#v
\n
%s"
,
pod
,
&
podListOut
,
string
(
yaml
))
}
}
}
}
}
pkg/kubelet/config/file_test.go
View file @
656fa7be
...
@@ -17,7 +17,6 @@ limitations under the License.
...
@@ -17,7 +17,6 @@ limitations under the License.
package
config
package
config
import
(
import
(
"fmt"
"io/ioutil"
"io/ioutil"
"os"
"os"
"testing"
"testing"
...
@@ -68,99 +67,6 @@ func writeTestFile(t *testing.T, dir, name string, contents string) *os.File {
...
@@ -68,99 +67,6 @@ func writeTestFile(t *testing.T, dir, name string, contents string) *os.File {
return
file
return
file
}
}
func
TestReadContainerManifestFromFile
(
t
*
testing
.
T
)
{
// ContainerManifest is supported only for pre v1beta3 versions.
if
!
api
.
PreV1Beta3
(
testapi
.
Version
())
{
return
}
hostname
:=
"random-test-hostname"
var
testCases
=
[]
struct
{
desc
string
fileContents
string
expected
kubelet
.
PodUpdate
}{
{
desc
:
"Manifest"
,
fileContents
:
fmt
.
Sprintf
(
`{
"version": "%s",
"uuid": "12345",
"id": "test",
"containers": [{ "name": "image", "image": "test/image", "imagePullPolicy": "PullAlways"}]
}`
,
testapi
.
Version
()),
expected
:
CreatePodUpdate
(
kubelet
.
SET
,
kubelet
.
FileSource
,
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"test-"
+
hostname
,
UID
:
"12345"
,
Namespace
:
kubelet
.
NamespaceDefault
,
SelfLink
:
getSelfLink
(
"test-"
+
hostname
,
kubelet
.
NamespaceDefault
),
},
Spec
:
api
.
PodSpec
{
NodeName
:
hostname
,
RestartPolicy
:
api
.
RestartPolicyAlways
,
DNSPolicy
:
api
.
DNSClusterFirst
,
Containers
:
[]
api
.
Container
{{
Name
:
"image"
,
Image
:
"test/image"
,
TerminationMessagePath
:
"/dev/termination-log"
,
ImagePullPolicy
:
"Always"
,
SecurityContext
:
securitycontext
.
ValidSecurityContextWithContainerDefaults
()}},
},
}),
},
{
desc
:
"Manifest without ID"
,
fileContents
:
fmt
.
Sprintf
(
`{
"version": "%s",
"uuid": "12345",
"containers": [{ "name": "image", "image": "test/image", "imagePullPolicy": "PullAlways"}]
}`
,
testapi
.
Version
()),
expected
:
CreatePodUpdate
(
kubelet
.
SET
,
kubelet
.
FileSource
,
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"12345-"
+
hostname
,
UID
:
"12345"
,
Namespace
:
kubelet
.
NamespaceDefault
,
SelfLink
:
getSelfLink
(
"12345-"
+
hostname
,
kubelet
.
NamespaceDefault
),
},
Spec
:
api
.
PodSpec
{
NodeName
:
hostname
,
RestartPolicy
:
api
.
RestartPolicyAlways
,
DNSPolicy
:
api
.
DNSClusterFirst
,
Containers
:
[]
api
.
Container
{{
Name
:
"image"
,
Image
:
"test/image"
,
TerminationMessagePath
:
"/dev/termination-log"
,
ImagePullPolicy
:
"Always"
,
SecurityContext
:
securitycontext
.
ValidSecurityContextWithContainerDefaults
()}},
},
}),
},
}
for
_
,
testCase
:=
range
testCases
{
func
()
{
file
:=
writeTestFile
(
t
,
os
.
TempDir
(),
"test_pod_config"
,
testCase
.
fileContents
)
defer
os
.
Remove
(
file
.
Name
())
ch
:=
make
(
chan
interface
{})
NewSourceFile
(
file
.
Name
(),
hostname
,
time
.
Millisecond
,
ch
)
select
{
case
got
:=
<-
ch
:
update
:=
got
.
(
kubelet
.
PodUpdate
)
for
_
,
pod
:=
range
update
.
Pods
{
if
errs
:=
validation
.
ValidatePod
(
pod
);
len
(
errs
)
>
0
{
t
.
Errorf
(
"%s: Invalid pod %#v, %#v"
,
testCase
.
desc
,
pod
,
errs
)
}
}
if
!
api
.
Semantic
.
DeepEqual
(
testCase
.
expected
,
update
)
{
t
.
Errorf
(
"%s: Expected %#v, Got %#v"
,
testCase
.
desc
,
testCase
.
expected
,
update
)
}
case
<-
time
.
After
(
time
.
Second
)
:
t
.
Errorf
(
"%s: Expected update, timeout instead"
,
testCase
.
desc
)
}
}()
}
}
func
TestReadPodsFromFile
(
t
*
testing
.
T
)
{
func
TestReadPodsFromFile
(
t
*
testing
.
T
)
{
hostname
:=
"random-test-hostname"
hostname
:=
"random-test-hostname"
var
testCases
=
[]
struct
{
var
testCases
=
[]
struct
{
...
@@ -276,32 +182,6 @@ func TestReadPodsFromFile(t *testing.T) {
...
@@ -276,32 +182,6 @@ func TestReadPodsFromFile(t *testing.T) {
}
}
}
}
func
TestReadManifestFromFileWithDefaults
(
t
*
testing
.
T
)
{
if
!
api
.
PreV1Beta3
(
testapi
.
Version
())
{
return
}
file
:=
writeTestFile
(
t
,
os
.
TempDir
(),
"test_pod_config"
,
fmt
.
Sprintf
(
`{
"version": "%s",
"id": "test",
"containers": [{ "name": "image", "image": "test/image" }]
}`
,
testapi
.
Version
()))
defer
os
.
Remove
(
file
.
Name
())
ch
:=
make
(
chan
interface
{})
NewSourceFile
(
file
.
Name
(),
"localhost"
,
time
.
Millisecond
,
ch
)
select
{
case
got
:=
<-
ch
:
update
:=
got
.
(
kubelet
.
PodUpdate
)
if
update
.
Pods
[
0
]
.
UID
==
""
{
t
.
Errorf
(
"Unexpected UID: %s"
,
update
.
Pods
[
0
]
.
UID
)
}
case
<-
time
.
After
(
time
.
Second
)
:
t
.
Errorf
(
"Expected update, timeout instead"
)
}
}
func
TestExtractFromBadDataFile
(
t
*
testing
.
T
)
{
func
TestExtractFromBadDataFile
(
t
*
testing
.
T
)
{
file
:=
writeTestFile
(
t
,
os
.
TempDir
(),
"test_pod_config"
,
string
([]
byte
{
1
,
2
,
3
}))
file
:=
writeTestFile
(
t
,
os
.
TempDir
(),
"test_pod_config"
,
string
([]
byte
{
1
,
2
,
3
}))
defer
os
.
Remove
(
file
.
Name
())
defer
os
.
Remove
(
file
.
Name
())
...
...
pkg/runtime/helper_test.go
View file @
656fa7be
...
@@ -138,6 +138,7 @@ func TestDecodeList(t *testing.T) {
...
@@ -138,6 +138,7 @@ func TestDecodeList(t *testing.T) {
Items
:
[]
runtime
.
Object
{
Items
:
[]
runtime
.
Object
{
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"1"
}},
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"1"
}},
&
runtime
.
Unknown
{
TypeMeta
:
runtime
.
TypeMeta
{
Kind
:
"Pod"
,
APIVersion
:
"v1beta3"
},
RawJSON
:
[]
byte
(
`{"kind":"Pod","apiVersion":"v1beta3","metadata":{"name":"test"}}`
)},
&
runtime
.
Unknown
{
TypeMeta
:
runtime
.
TypeMeta
{
Kind
:
"Pod"
,
APIVersion
:
"v1beta3"
},
RawJSON
:
[]
byte
(
`{"kind":"Pod","apiVersion":"v1beta3","metadata":{"name":"test"}}`
)},
&
runtime
.
Unknown
{
TypeMeta
:
runtime
.
TypeMeta
{
Kind
:
"Pod"
,
APIVersion
:
"v1"
},
RawJSON
:
[]
byte
(
`{"kind":"Pod","apiVersion":"v1","metadata":{"name":"test"}}`
)},
&
runtime
.
Unstructured
{
TypeMeta
:
runtime
.
TypeMeta
{
Kind
:
"Foo"
,
APIVersion
:
"Bar"
},
Object
:
map
[
string
]
interface
{}{
"test"
:
"value"
}},
&
runtime
.
Unstructured
{
TypeMeta
:
runtime
.
TypeMeta
{
Kind
:
"Foo"
,
APIVersion
:
"Bar"
},
Object
:
map
[
string
]
interface
{}{
"test"
:
"value"
}},
},
},
}
}
...
...
pkg/runtime/unstructured_test.go
View file @
656fa7be
...
@@ -29,6 +29,8 @@ func TestDecodeUnstructured(t *testing.T) {
...
@@ -29,6 +29,8 @@ func TestDecodeUnstructured(t *testing.T) {
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"1"
}},
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"1"
}},
&
runtime
.
Unknown
{
TypeMeta
:
runtime
.
TypeMeta
{
Kind
:
"Pod"
,
APIVersion
:
"v1beta3"
},
RawJSON
:
[]
byte
(
`{"kind":"Pod","apiVersion":"v1beta3","metadata":{"name":"test"}}`
)},
&
runtime
.
Unknown
{
TypeMeta
:
runtime
.
TypeMeta
{
Kind
:
"Pod"
,
APIVersion
:
"v1beta3"
},
RawJSON
:
[]
byte
(
`{"kind":"Pod","apiVersion":"v1beta3","metadata":{"name":"test"}}`
)},
&
runtime
.
Unknown
{
TypeMeta
:
runtime
.
TypeMeta
{
Kind
:
""
,
APIVersion
:
"v1beta3"
},
RawJSON
:
[]
byte
(
`{"kind":"Pod","apiVersion":"v1beta3","metadata":{"name":"test"}}`
)},
&
runtime
.
Unknown
{
TypeMeta
:
runtime
.
TypeMeta
{
Kind
:
""
,
APIVersion
:
"v1beta3"
},
RawJSON
:
[]
byte
(
`{"kind":"Pod","apiVersion":"v1beta3","metadata":{"name":"test"}}`
)},
&
runtime
.
Unknown
{
TypeMeta
:
runtime
.
TypeMeta
{
Kind
:
"Pod"
,
APIVersion
:
"v1"
},
RawJSON
:
[]
byte
(
`{"kind":"Pod","apiVersion":"v1","metadata":{"name":"test"}}`
)},
&
runtime
.
Unknown
{
TypeMeta
:
runtime
.
TypeMeta
{
Kind
:
""
,
APIVersion
:
"v1"
},
RawJSON
:
[]
byte
(
`{"kind":"Pod","apiVersion":"v1","metadata":{"name":"test"}}`
)},
&
runtime
.
Unstructured
{
TypeMeta
:
runtime
.
TypeMeta
{
Kind
:
"Foo"
,
APIVersion
:
"Bar"
},
Object
:
map
[
string
]
interface
{}{
"test"
:
"value"
}},
&
runtime
.
Unstructured
{
TypeMeta
:
runtime
.
TypeMeta
{
Kind
:
"Foo"
,
APIVersion
:
"Bar"
},
Object
:
map
[
string
]
interface
{}{
"test"
:
"value"
}},
},
},
}
}
...
...
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