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
8cf6d785
Commit
8cf6d785
authored
Nov 10, 2015
by
feihujiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move defaulting funcs from internal to v1
parent
fc5066aa
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
11 deletions
+19
-11
conversion.go
pkg/api/conversion.go
+0
-9
serialization_test.go
pkg/api/serialization_test.go
+3
-2
fuzzer.go
pkg/api/testing/fuzzer.go
+8
-0
defaults.go
pkg/api/v1/defaults.go
+8
-0
No files found.
pkg/api/conversion.go
View file @
8cf6d785
...
@@ -35,15 +35,6 @@ func init() {
...
@@ -35,15 +35,6 @@ func init() {
obj
.
LabelSelector
=
labels
.
Everything
()
obj
.
LabelSelector
=
labels
.
Everything
()
obj
.
FieldSelector
=
fields
.
Everything
()
obj
.
FieldSelector
=
fields
.
Everything
()
},
},
// TODO: see about moving this into v1/defaults.go
func
(
obj
*
PodExecOptions
)
{
obj
.
Stderr
=
true
obj
.
Stdout
=
true
},
func
(
obj
*
PodAttachOptions
)
{
obj
.
Stderr
=
true
obj
.
Stdout
=
true
},
)
)
Scheme
.
AddConversionFuncs
(
Scheme
.
AddConversionFuncs
(
func
(
in
*
unversioned
.
Time
,
out
*
unversioned
.
Time
,
s
conversion
.
Scope
)
error
{
func
(
in
*
unversioned
.
Time
,
out
*
unversioned
.
Time
,
s
conversion
.
Scope
)
error
{
...
...
pkg/api/serialization_test.go
View file @
8cf6d785
...
@@ -70,7 +70,7 @@ func roundTrip(t *testing.T, codec runtime.Codec, item runtime.Object) {
...
@@ -70,7 +70,7 @@ func roundTrip(t *testing.T, codec runtime.Codec, item runtime.Object) {
return
return
}
}
if
!
api
.
Semantic
.
DeepEqual
(
item
,
obj2
)
{
if
!
api
.
Semantic
.
DeepEqual
(
item
,
obj2
)
{
t
.
Errorf
(
"1: %v: diff: %v
\n
Codec: %v
\n
Source:
\n\n
%#v
\n\n
Encoded:
\n\n
%s
\n\n
Final:
\n\n
%#v"
,
name
,
util
.
ObjectGoPrintDiff
(
item
,
obj2
),
codec
,
printer
.
Sprintf
(
"%#v"
,
item
),
string
(
data
),
printer
.
Sprintf
(
"%#v"
,
obj2
))
t
.
Errorf
(
"
\n
1: %v: diff: %v
\n
Codec: %v
\n
Source:
\n\n
%#v
\n\n
Encoded:
\n\n
%s
\n\n
Final:
\n\n
%#v"
,
name
,
util
.
ObjectGoPrintDiff
(
item
,
obj2
),
codec
,
printer
.
Sprintf
(
"%#v"
,
item
),
string
(
data
),
printer
.
Sprintf
(
"%#v"
,
obj2
))
return
return
}
}
...
@@ -128,7 +128,8 @@ func TestList(t *testing.T) {
...
@@ -128,7 +128,8 @@ func TestList(t *testing.T) {
}
}
var
nonRoundTrippableTypes
=
sets
.
NewString
()
var
nonRoundTrippableTypes
=
sets
.
NewString
()
var
nonInternalRoundTrippableTypes
=
sets
.
NewString
(
"List"
,
"ListOptions"
,
"PodExecOptions"
,
"PodAttachOptions"
)
var
nonInternalRoundTrippableTypes
=
sets
.
NewString
(
"List"
,
"ListOptions"
)
var
nonRoundTrippableTypesByVersion
=
map
[
string
][]
string
{}
var
nonRoundTrippableTypesByVersion
=
map
[
string
][]
string
{}
func
TestRoundTripTypes
(
t
*
testing
.
T
)
{
func
TestRoundTripTypes
(
t
*
testing
.
T
)
{
...
...
pkg/api/testing/fuzzer.go
View file @
8cf6d785
...
@@ -91,6 +91,14 @@ func FuzzerFor(t *testing.T, version string, src rand.Source) *fuzz.Fuzzer {
...
@@ -91,6 +91,14 @@ func FuzzerFor(t *testing.T, version string, src rand.Source) *fuzz.Fuzzer {
j
.
LabelSelector
,
_
=
labels
.
Parse
(
"a=b"
)
j
.
LabelSelector
,
_
=
labels
.
Parse
(
"a=b"
)
j
.
FieldSelector
,
_
=
fields
.
ParseSelector
(
"a=b"
)
j
.
FieldSelector
,
_
=
fields
.
ParseSelector
(
"a=b"
)
},
},
func
(
j
*
api
.
PodExecOptions
,
c
fuzz
.
Continue
)
{
j
.
Stdout
=
true
j
.
Stderr
=
true
},
func
(
j
*
api
.
PodAttachOptions
,
c
fuzz
.
Continue
)
{
j
.
Stdout
=
true
j
.
Stderr
=
true
},
func
(
s
*
api
.
PodSpec
,
c
fuzz
.
Continue
)
{
func
(
s
*
api
.
PodSpec
,
c
fuzz
.
Continue
)
{
c
.
FuzzNoCustom
(
s
)
c
.
FuzzNoCustom
(
s
)
// has a default value
// has a default value
...
...
pkg/api/v1/defaults.go
View file @
8cf6d785
...
@@ -25,6 +25,14 @@ import (
...
@@ -25,6 +25,14 @@ import (
func
addDefaultingFuncs
()
{
func
addDefaultingFuncs
()
{
api
.
Scheme
.
AddDefaultingFuncs
(
api
.
Scheme
.
AddDefaultingFuncs
(
func
(
obj
*
PodExecOptions
)
{
obj
.
Stdout
=
true
obj
.
Stderr
=
true
},
func
(
obj
*
PodAttachOptions
)
{
obj
.
Stdout
=
true
obj
.
Stderr
=
true
},
func
(
obj
*
ReplicationController
)
{
func
(
obj
*
ReplicationController
)
{
var
labels
map
[
string
]
string
var
labels
map
[
string
]
string
if
obj
.
Spec
.
Template
!=
nil
{
if
obj
.
Spec
.
Template
!=
nil
{
...
...
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