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
0a8e2e0b
Commit
0a8e2e0b
authored
Mar 31, 2015
by
Tim Hockin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6235 from yujuhong/defaults_tests
defaults_tests: verify defaults when converting to an API object
parents
903fb42a
7b0e45a5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
10 deletions
+29
-10
types.go
pkg/api/types.go
+2
-1
defaults_test.go
pkg/api/v1beta1/defaults_test.go
+9
-3
defaults_test.go
pkg/api/v1beta2/defaults_test.go
+9
-3
defaults_test.go
pkg/api/v1beta3/defaults_test.go
+9
-3
No files found.
pkg/api/types.go
View file @
0a8e2e0b
...
@@ -1509,7 +1509,8 @@ type ContainerManifest struct {
...
@@ -1509,7 +1509,8 @@ type ContainerManifest struct {
Containers
[]
Container
`json:"containers"`
Containers
[]
Container
`json:"containers"`
RestartPolicy
RestartPolicy
`json:"restartPolicy,omitempty"`
RestartPolicy
RestartPolicy
`json:"restartPolicy,omitempty"`
// Required: Set DNS policy.
// Required: Set DNS policy.
DNSPolicy
DNSPolicy
`json:"dnsPolicy"`
DNSPolicy
DNSPolicy
`json:"dnsPolicy"`
HostNetwork
bool
`json:"hostNetwork,omitempty"`
}
}
// ContainerManifestList is used to communicate container manifests to kubelet.
// ContainerManifestList is used to communicate container manifests to kubelet.
...
...
pkg/api/v1beta1/defaults_test.go
View file @
0a8e2e0b
...
@@ -20,6 +20,7 @@ import (
...
@@ -20,6 +20,7 @@ import (
"reflect"
"reflect"
"testing"
"testing"
newer
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
current
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1beta1"
current
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1beta1"
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
)
)
...
@@ -30,13 +31,18 @@ func roundTrip(t *testing.T, obj runtime.Object) runtime.Object {
...
@@ -30,13 +31,18 @@ func roundTrip(t *testing.T, obj runtime.Object) runtime.Object {
t
.
Errorf
(
"%v
\n
%#v"
,
err
,
obj
)
t
.
Errorf
(
"%v
\n
%#v"
,
err
,
obj
)
return
nil
return
nil
}
}
obj2
:=
reflect
.
New
(
reflect
.
TypeOf
(
obj
)
.
Elem
())
.
Interface
()
.
(
runtime
.
Object
)
obj2
,
err
:=
newer
.
Codec
.
Decode
(
data
)
err
=
current
.
Codec
.
DecodeInto
(
data
,
obj2
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"%v
\n
Data: %s
\n
Source: %#v"
,
err
,
string
(
data
),
obj
)
t
.
Errorf
(
"%v
\n
Data: %s
\n
Source: %#v"
,
err
,
string
(
data
),
obj
)
return
nil
return
nil
}
}
return
obj2
obj3
:=
reflect
.
New
(
reflect
.
TypeOf
(
obj
)
.
Elem
())
.
Interface
()
.
(
runtime
.
Object
)
err
=
newer
.
Scheme
.
Convert
(
obj2
,
obj3
)
if
err
!=
nil
{
t
.
Errorf
(
"%v
\n
Source: %#v"
,
err
,
obj2
)
return
nil
}
return
obj3
}
}
func
TestSetDefaultService
(
t
*
testing
.
T
)
{
func
TestSetDefaultService
(
t
*
testing
.
T
)
{
...
...
pkg/api/v1beta2/defaults_test.go
View file @
0a8e2e0b
...
@@ -20,6 +20,7 @@ import (
...
@@ -20,6 +20,7 @@ import (
"reflect"
"reflect"
"testing"
"testing"
newer
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
current
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1beta2"
current
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1beta2"
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
)
)
...
@@ -30,13 +31,18 @@ func roundTrip(t *testing.T, obj runtime.Object) runtime.Object {
...
@@ -30,13 +31,18 @@ func roundTrip(t *testing.T, obj runtime.Object) runtime.Object {
t
.
Errorf
(
"%v
\n
%#v"
,
err
,
obj
)
t
.
Errorf
(
"%v
\n
%#v"
,
err
,
obj
)
return
nil
return
nil
}
}
obj2
:=
reflect
.
New
(
reflect
.
TypeOf
(
obj
)
.
Elem
())
.
Interface
()
.
(
runtime
.
Object
)
obj2
,
err
:=
newer
.
Codec
.
Decode
(
data
)
err
=
current
.
Codec
.
DecodeInto
(
data
,
obj2
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"%v
\n
Data: %s
\n
Source: %#v"
,
err
,
string
(
data
),
obj
)
t
.
Errorf
(
"%v
\n
Data: %s
\n
Source: %#v"
,
err
,
string
(
data
),
obj
)
return
nil
return
nil
}
}
return
obj2
obj3
:=
reflect
.
New
(
reflect
.
TypeOf
(
obj
)
.
Elem
())
.
Interface
()
.
(
runtime
.
Object
)
err
=
newer
.
Scheme
.
Convert
(
obj2
,
obj3
)
if
err
!=
nil
{
t
.
Errorf
(
"%v
\n
Source: %#v"
,
err
,
obj2
)
return
nil
}
return
obj3
}
}
func
TestSetDefaultService
(
t
*
testing
.
T
)
{
func
TestSetDefaultService
(
t
*
testing
.
T
)
{
...
...
pkg/api/v1beta3/defaults_test.go
View file @
0a8e2e0b
...
@@ -20,6 +20,7 @@ import (
...
@@ -20,6 +20,7 @@ import (
"reflect"
"reflect"
"testing"
"testing"
newer
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
current
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1beta3"
current
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1beta3"
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
...
@@ -31,13 +32,18 @@ func roundTrip(t *testing.T, obj runtime.Object) runtime.Object {
...
@@ -31,13 +32,18 @@ func roundTrip(t *testing.T, obj runtime.Object) runtime.Object {
t
.
Errorf
(
"%v
\n
%#v"
,
err
,
obj
)
t
.
Errorf
(
"%v
\n
%#v"
,
err
,
obj
)
return
nil
return
nil
}
}
obj2
:=
reflect
.
New
(
reflect
.
TypeOf
(
obj
)
.
Elem
())
.
Interface
()
.
(
runtime
.
Object
)
obj2
,
err
:=
newer
.
Codec
.
Decode
(
data
)
err
=
current
.
Codec
.
DecodeInto
(
data
,
obj2
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"%v
\n
Data: %s
\n
Source: %#v"
,
err
,
string
(
data
),
obj
)
t
.
Errorf
(
"%v
\n
Data: %s
\n
Source: %#v"
,
err
,
string
(
data
),
obj
)
return
nil
return
nil
}
}
return
obj2
obj3
:=
reflect
.
New
(
reflect
.
TypeOf
(
obj
)
.
Elem
())
.
Interface
()
.
(
runtime
.
Object
)
err
=
newer
.
Scheme
.
Convert
(
obj2
,
obj3
)
if
err
!=
nil
{
t
.
Errorf
(
"%v
\n
Source: %#v"
,
err
,
obj2
)
return
nil
}
return
obj3
}
}
func
TestSetDefaultService
(
t
*
testing
.
T
)
{
func
TestSetDefaultService
(
t
*
testing
.
T
)
{
...
...
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