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
714dbf45
Commit
714dbf45
authored
Dec 03, 2014
by
Clayton Coleman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Shrink runtime.TypeMeta to be equivalent to api TypeMeta
Remove unused fuzzing
parent
dd24b013
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
33 deletions
+6
-33
serialization_test.go
pkg/api/serialization_test.go
+0
-9
schema_test.go
pkg/api/validation/schema_test.go
+0
-9
embedded_test.go
pkg/runtime/embedded_test.go
+3
-3
types.go
pkg/runtime/types.go
+3
-12
No files found.
pkg/api/serialization_test.go
View file @
714dbf45
...
@@ -48,15 +48,6 @@ var apiObjectFuzzer = fuzz.New().NilChance(.5).NumElements(1, 1).Funcs(
...
@@ -48,15 +48,6 @@ var apiObjectFuzzer = fuzz.New().NilChance(.5).NumElements(1, 1).Funcs(
// APIVersion and Kind must remain blank in memory.
// APIVersion and Kind must remain blank in memory.
j
.
APIVersion
=
""
j
.
APIVersion
=
""
j
.
Kind
=
""
j
.
Kind
=
""
j
.
Name
=
c
.
RandString
()
j
.
ResourceVersion
=
strconv
.
FormatUint
(
c
.
RandUint64
(),
10
)
j
.
SelfLink
=
c
.
RandString
()
var
sec
,
nsec
int64
c
.
Fuzz
(
&
sec
)
c
.
Fuzz
(
&
nsec
)
j
.
CreationTimestamp
=
util
.
Unix
(
sec
,
nsec
)
.
Rfc3339Copy
()
},
},
func
(
j
*
api
.
TypeMeta
,
c
fuzz
.
Continue
)
{
func
(
j
*
api
.
TypeMeta
,
c
fuzz
.
Continue
)
{
// We have to customize the randomization of TypeMetas because their
// We have to customize the randomization of TypeMetas because their
...
...
pkg/api/validation/schema_test.go
View file @
714dbf45
...
@@ -49,15 +49,6 @@ var apiObjectFuzzer = fuzz.New().NilChance(.5).NumElements(1, 1).Funcs(
...
@@ -49,15 +49,6 @@ var apiObjectFuzzer = fuzz.New().NilChance(.5).NumElements(1, 1).Funcs(
// APIVersion and Kind must remain blank in memory.
// APIVersion and Kind must remain blank in memory.
j
.
APIVersion
=
""
j
.
APIVersion
=
""
j
.
Kind
=
""
j
.
Kind
=
""
j
.
Name
=
c
.
RandString
()
j
.
ResourceVersion
=
strconv
.
FormatUint
(
c
.
RandUint64
(),
10
)
j
.
SelfLink
=
c
.
RandString
()
var
sec
,
nsec
int64
c
.
Fuzz
(
&
sec
)
c
.
Fuzz
(
&
nsec
)
j
.
CreationTimestamp
=
util
.
Unix
(
sec
,
nsec
)
.
Rfc3339Copy
()
},
},
func
(
j
*
api
.
TypeMeta
,
c
fuzz
.
Continue
)
{
func
(
j
*
api
.
TypeMeta
,
c
fuzz
.
Continue
)
{
// We have to customize the randomization of TypeMetas because their
// We have to customize the randomization of TypeMetas because their
...
...
pkg/runtime/embedded_test.go
View file @
714dbf45
...
@@ -50,11 +50,11 @@ func TestEmbeddedObject(t *testing.T) {
...
@@ -50,11 +50,11 @@ func TestEmbeddedObject(t *testing.T) {
s
.
AddKnownTypeWithName
(
"v1test"
,
"EmbeddedTest"
,
&
EmbeddedTestExternal
{})
s
.
AddKnownTypeWithName
(
"v1test"
,
"EmbeddedTest"
,
&
EmbeddedTestExternal
{})
outer
:=
&
EmbeddedTest
{
outer
:=
&
EmbeddedTest
{
TypeMeta
:
runtime
.
TypeMeta
{
Name
:
"outer"
},
TypeMeta
:
runtime
.
TypeMeta
{},
ID
:
"outer"
,
ID
:
"outer"
,
Object
:
runtime
.
EmbeddedObject
{
Object
:
runtime
.
EmbeddedObject
{
&
EmbeddedTest
{
&
EmbeddedTest
{
TypeMeta
:
runtime
.
TypeMeta
{
Name
:
"inner"
},
TypeMeta
:
runtime
.
TypeMeta
{},
ID
:
"inner"
,
ID
:
"inner"
,
},
},
},
},
...
@@ -83,7 +83,7 @@ func TestEmbeddedObject(t *testing.T) {
...
@@ -83,7 +83,7 @@ func TestEmbeddedObject(t *testing.T) {
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatalf
(
"Unexpected decode error %v"
,
err
)
t
.
Fatalf
(
"Unexpected decode error %v"
,
err
)
}
}
if
externalViaJSON
.
Kind
==
""
||
externalViaJSON
.
APIVersion
==
""
||
externalViaJSON
.
Name
!=
"outer"
{
if
externalViaJSON
.
Kind
==
""
||
externalViaJSON
.
APIVersion
==
""
||
externalViaJSON
.
ID
!=
"outer"
{
t
.
Errorf
(
"Expected objects to have type info set, got %#v"
,
externalViaJSON
)
t
.
Errorf
(
"Expected objects to have type info set, got %#v"
,
externalViaJSON
)
}
}
if
!
reflect
.
DeepEqual
(
externalViaJSON
.
EmptyObject
.
RawJSON
,
[]
byte
(
"null"
))
||
len
(
externalViaJSON
.
Object
.
RawJSON
)
==
0
{
if
!
reflect
.
DeepEqual
(
externalViaJSON
.
EmptyObject
.
RawJSON
,
[]
byte
(
"null"
))
||
len
(
externalViaJSON
.
Object
.
RawJSON
)
==
0
{
...
...
pkg/runtime/types.go
View file @
714dbf45
...
@@ -16,9 +16,7 @@ limitations under the License.
...
@@ -16,9 +16,7 @@ limitations under the License.
package
runtime
package
runtime
import
(
import
()
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
)
// Note that the types provided in this file are not versioned and are intended to be
// Note that the types provided in this file are not versioned and are intended to be
// safe to use from within all versions of every API object.
// safe to use from within all versions of every API object.
...
@@ -35,15 +33,8 @@ import (
...
@@ -35,15 +33,8 @@ import (
// your own with the same fields.
// your own with the same fields.
//
//
type
TypeMeta
struct
{
type
TypeMeta
struct
{
APIVersion
string
`json:"apiVersion,omitempty"`
APIVersion
string
`json:"apiVersion,omitempty" yaml:"apiVersion,omitempty"`
Kind
string
`json:"kind,omitempty"`
Kind
string
`json:"kind,omitempty" yaml:"kind,omitempty"`
Namespace
string
`json:"namespace,omitempty"`
Name
string
`json:"name,omitempty"`
UID
string
`json:"uid,omitempty"`
CreationTimestamp
util
.
Time
`json:"creationTimestamp,omitempty"`
SelfLink
string
`json:"selfLink,omitempty"`
ResourceVersion
string
`json:"resourceVersion,omitempty"`
}
}
// PluginBase is like TypeMeta, but it's intended for plugin objects that won't ever be encoded
// PluginBase is like TypeMeta, but it's intended for plugin objects that won't ever be encoded
...
...
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