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
2d5fe9d8
Commit
2d5fe9d8
authored
Feb 14, 2017
by
deads2k
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add sample fuzzing tests
parent
d3086944
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
167 additions
and
76 deletions
+167
-76
BUILD
cmd/kubeadm/app/apis/kubeadm/BUILD
+3
-16
fuzzer.go
cmd/kubeadm/app/apis/kubeadm/fuzzer.go
+37
-0
BUILD
cmd/kubeadm/app/apis/kubeadm/install/BUILD
+12
-0
install_test.go
cmd/kubeadm/app/apis/kubeadm/install/install_test.go
+28
-0
register.go
cmd/kubeadm/app/apis/kubeadm/register.go
+0
-4
BUILD
cmd/kubeadm/app/apis/kubeadm/v1alpha1/BUILD
+0
-2
register.go
cmd/kubeadm/app/apis/kubeadm/v1alpha1/register.go
+1
-5
.linted_packages
hack/.linted_packages
+0
-1
test.sh
hack/make-rules/test.sh
+3
-0
fuzzer.go
pkg/api/testing/fuzzer.go
+1
-15
fuzzer.go
staging/src/k8s.io/apimachinery/pkg/api/testing/fuzzer.go
+14
-1
roundtrip.go
staging/src/k8s.io/apimachinery/pkg/api/testing/roundtrip.go
+40
-0
install_test.go
.../sample-apiserver/pkg/apis/wardle/install/install_test.go
+7
-9
scheme_test.go
.../src/k8s.io/sample-apiserver/pkg/apiserver/scheme_test.go
+3
-23
BUILD
vendor/BUILD
+18
-0
No files found.
cmd/kubeadm/app/apis/kubeadm/BUILD
View file @
2d5fe9d8
...
@@ -5,7 +5,6 @@ licenses(["notice"])
...
@@ -5,7 +5,6 @@ licenses(["notice"])
load(
load(
"@io_bazel_rules_go//go:def.bzl",
"@io_bazel_rules_go//go:def.bzl",
"go_library",
"go_library",
"go_test",
)
)
go_library(
go_library(
...
@@ -13,11 +12,14 @@ go_library(
...
@@ -13,11 +12,14 @@ go_library(
srcs = [
srcs = [
"doc.go",
"doc.go",
"env.go",
"env.go",
"fuzzer.go",
"register.go",
"register.go",
"types.go",
"types.go",
],
],
tags = ["automanaged"],
tags = ["automanaged"],
deps = [
deps = [
"//vendor:github.com/google/gofuzz",
"//vendor:k8s.io/apimachinery/pkg/api/testing",
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
"//vendor:k8s.io/apimachinery/pkg/runtime",
"//vendor:k8s.io/apimachinery/pkg/runtime",
"//vendor:k8s.io/apimachinery/pkg/runtime/schema",
"//vendor:k8s.io/apimachinery/pkg/runtime/schema",
...
@@ -41,18 +43,3 @@ filegroup(
...
@@ -41,18 +43,3 @@ filegroup(
],
],
tags = ["automanaged"],
tags = ["automanaged"],
)
)
go_test(
name = "go_default_xtest",
srcs = ["serialization_test.go"],
tags = ["automanaged"],
deps = [
"//cmd/kubeadm/app/apis/kubeadm/install:go_default_library",
"//pkg/api/testing:go_default_library",
"//vendor:k8s.io/apimachinery/pkg/api/testing",
"//vendor:k8s.io/apimachinery/pkg/apimachinery/announced",
"//vendor:k8s.io/apimachinery/pkg/apimachinery/registered",
"//vendor:k8s.io/apimachinery/pkg/runtime",
"//vendor:k8s.io/apimachinery/pkg/runtime/serializer",
],
)
cmd/kubeadm/app/apis/kubeadm/fuzzer.go
0 → 100644
View file @
2d5fe9d8
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
kubeadm
import
(
"github.com/google/gofuzz"
apitesting
"k8s.io/apimachinery/pkg/api/testing"
)
func
KubeadmFuzzerFuncs
(
t
apitesting
.
TestingCommon
)
[]
interface
{}
{
return
[]
interface
{}{
func
(
obj
*
MasterConfiguration
,
c
fuzz
.
Continue
)
{
c
.
FuzzNoCustom
(
obj
)
obj
.
KubernetesVersion
=
"v10"
obj
.
API
.
Port
=
20
obj
.
Networking
.
ServiceSubnet
=
"foo"
obj
.
Networking
.
DNSDomain
=
"foo"
obj
.
AuthorizationMode
=
"foo"
obj
.
Discovery
.
Token
=
&
TokenDiscovery
{}
},
}
}
cmd/kubeadm/app/apis/kubeadm/install/BUILD
View file @
2d5fe9d8
...
@@ -5,6 +5,7 @@ licenses(["notice"])
...
@@ -5,6 +5,7 @@ licenses(["notice"])
load(
load(
"@io_bazel_rules_go//go:def.bzl",
"@io_bazel_rules_go//go:def.bzl",
"go_library",
"go_library",
"go_test",
)
)
go_library(
go_library(
...
@@ -36,3 +37,14 @@ filegroup(
...
@@ -36,3 +37,14 @@ filegroup(
srcs = [":package-srcs"],
srcs = [":package-srcs"],
tags = ["automanaged"],
tags = ["automanaged"],
)
)
go_test(
name = "go_default_test",
srcs = ["install_test.go"],
library = ":go_default_library",
tags = ["automanaged"],
deps = [
"//cmd/kubeadm/app/apis/kubeadm:go_default_library",
"//vendor:k8s.io/apimachinery/pkg/api/testing",
],
)
cmd/kubeadm/app/apis/kubeadm/install/install_test.go
0 → 100644
View file @
2d5fe9d8
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
install
import
(
"testing"
apitesting
"k8s.io/apimachinery/pkg/api/testing"
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
)
func
TestRoundTripTypes
(
t
*
testing
.
T
)
{
apitesting
.
RoundTripTestForAPIGroup
(
t
,
Install
,
kubeadm
.
KubeadmFuzzerFuncs
(
t
))
}
cmd/kubeadm/app/apis/kubeadm/register.go
View file @
2d5fe9d8
...
@@ -50,7 +50,3 @@ func addKnownTypes(scheme *runtime.Scheme) error {
...
@@ -50,7 +50,3 @@ func addKnownTypes(scheme *runtime.Scheme) error {
)
)
return
nil
return
nil
}
}
func
(
obj
*
MasterConfiguration
)
GetObjectKind
()
schema
.
ObjectKind
{
return
&
obj
.
TypeMeta
}
func
(
obj
*
NodeConfiguration
)
GetObjectKind
()
schema
.
ObjectKind
{
return
&
obj
.
TypeMeta
}
func
(
obj
*
ClusterInfo
)
GetObjectKind
()
schema
.
ObjectKind
{
return
&
obj
.
TypeMeta
}
cmd/kubeadm/app/apis/kubeadm/v1alpha1/BUILD
View file @
2d5fe9d8
...
@@ -10,7 +10,6 @@ load(
...
@@ -10,7 +10,6 @@ load(
go_library(
go_library(
name = "go_default_library",
name = "go_default_library",
srcs = [
srcs = [
"conversion.go",
"defaults.go",
"defaults.go",
"doc.go",
"doc.go",
"register.go",
"register.go",
...
@@ -22,7 +21,6 @@ go_library(
...
@@ -22,7 +21,6 @@ go_library(
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
"//vendor:k8s.io/apimachinery/pkg/runtime",
"//vendor:k8s.io/apimachinery/pkg/runtime",
"//vendor:k8s.io/apimachinery/pkg/runtime/schema",
"//vendor:k8s.io/apimachinery/pkg/runtime/schema",
"//vendor:k8s.io/client-go/pkg/api",
],
],
)
)
...
...
cmd/kubeadm/app/apis/kubeadm/v1alpha1/register.go
View file @
2d5fe9d8
...
@@ -29,7 +29,7 @@ const GroupName = "kubeadm.k8s.io"
...
@@ -29,7 +29,7 @@ const GroupName = "kubeadm.k8s.io"
var
SchemeGroupVersion
=
schema
.
GroupVersion
{
Group
:
GroupName
,
Version
:
"v1alpha1"
}
var
SchemeGroupVersion
=
schema
.
GroupVersion
{
Group
:
GroupName
,
Version
:
"v1alpha1"
}
var
(
var
(
SchemeBuilder
=
runtime
.
NewSchemeBuilder
(
addKnownTypes
,
addDefaultingFuncs
,
addConversionFuncs
)
SchemeBuilder
=
runtime
.
NewSchemeBuilder
(
addKnownTypes
,
addDefaultingFuncs
)
AddToScheme
=
SchemeBuilder
.
AddToScheme
AddToScheme
=
SchemeBuilder
.
AddToScheme
)
)
...
@@ -52,7 +52,3 @@ func addKnownTypes(scheme *runtime.Scheme) error {
...
@@ -52,7 +52,3 @@ func addKnownTypes(scheme *runtime.Scheme) error {
metav1
.
AddToGroupVersion
(
scheme
,
SchemeGroupVersion
)
metav1
.
AddToGroupVersion
(
scheme
,
SchemeGroupVersion
)
return
nil
return
nil
}
}
func
(
obj
*
MasterConfiguration
)
GetObjectKind
()
schema
.
ObjectKind
{
return
&
obj
.
TypeMeta
}
func
(
obj
*
NodeConfiguration
)
GetObjectKind
()
schema
.
ObjectKind
{
return
&
obj
.
TypeMeta
}
func
(
obj
*
ClusterInfo
)
GetObjectKind
()
schema
.
ObjectKind
{
return
&
obj
.
TypeMeta
}
hack/.linted_packages
View file @
2d5fe9d8
...
@@ -16,7 +16,6 @@ cmd/kube-controller-manager/app/options
...
@@ -16,7 +16,6 @@ cmd/kube-controller-manager/app/options
cmd/kube-discovery
cmd/kube-discovery
cmd/kube-proxy
cmd/kube-proxy
cmd/kubeadm
cmd/kubeadm
cmd/kubeadm/app/apis/kubeadm
cmd/kubeadm/app/apis/kubeadm/install
cmd/kubeadm/app/apis/kubeadm/install
cmd/kubeadm/app/phases/apiconfig
cmd/kubeadm/app/phases/apiconfig
cmd/kubeadm/app/phases/certs
cmd/kubeadm/app/phases/certs
...
...
hack/make-rules/test.sh
View file @
2d5fe9d8
...
@@ -70,6 +70,9 @@ kube::test::find_dirs() {
...
@@ -70,6 +70,9 @@ kube::test::find_dirs() {
find ./staging/src/k8s.io/kube-aggregator
-name
'*_test.go'
\
find ./staging/src/k8s.io/kube-aggregator
-name
'*_test.go'
\
-name
'*_test.go'
-print0
| xargs
-0n1
dirname
|
sed
's|^\./staging/src/|./vendor/|'
|
LC_ALL
=
C
sort
-u
-name
'*_test.go'
-print0
| xargs
-0n1
dirname
|
sed
's|^\./staging/src/|./vendor/|'
|
LC_ALL
=
C
sort
-u
find ./staging/src/k8s.io/sample-apiserver
-name
'*_test.go'
\
-name
'*_test.go'
-print0
| xargs
-0n1
dirname
|
sed
's|^\./staging/src/|./vendor/|'
|
LC_ALL
=
C
sort
-u
)
)
}
}
...
...
pkg/api/testing/fuzzer.go
View file @
2d5fe9d8
...
@@ -610,20 +610,6 @@ func rbacFuncs(t apitesting.TestingCommon) []interface{} {
...
@@ -610,20 +610,6 @@ func rbacFuncs(t apitesting.TestingCommon) []interface{} {
}
}
}
}
func
kubeAdmFuncs
(
t
apitesting
.
TestingCommon
)
[]
interface
{}
{
return
[]
interface
{}{
func
(
obj
*
kubeadm
.
MasterConfiguration
,
c
fuzz
.
Continue
)
{
c
.
FuzzNoCustom
(
obj
)
obj
.
KubernetesVersion
=
"v10"
obj
.
API
.
Port
=
20
obj
.
Networking
.
ServiceSubnet
=
"foo"
obj
.
Networking
.
DNSDomain
=
"foo"
obj
.
AuthorizationMode
=
"foo"
obj
.
Discovery
.
Token
=
&
kubeadm
.
TokenDiscovery
{}
},
}
}
func
policyFuncs
(
t
apitesting
.
TestingCommon
)
[]
interface
{}
{
func
policyFuncs
(
t
apitesting
.
TestingCommon
)
[]
interface
{}
{
return
[]
interface
{}{
return
[]
interface
{}{
func
(
s
*
policy
.
PodDisruptionBudgetStatus
,
c
fuzz
.
Continue
)
{
func
(
s
*
policy
.
PodDisruptionBudgetStatus
,
c
fuzz
.
Continue
)
{
...
@@ -651,7 +637,7 @@ func FuzzerFuncs(t apitesting.TestingCommon, codecs runtimeserializer.CodecFacto
...
@@ -651,7 +637,7 @@ func FuzzerFuncs(t apitesting.TestingCommon, codecs runtimeserializer.CodecFacto
batchFuncs
(
t
),
batchFuncs
(
t
),
autoscalingFuncs
(
t
),
autoscalingFuncs
(
t
),
rbacFuncs
(
t
),
rbacFuncs
(
t
),
kube
Adm
Funcs
(
t
),
kube
adm
.
KubeadmFuzzer
Funcs
(
t
),
policyFuncs
(
t
),
policyFuncs
(
t
),
certificateFuncs
(
t
),
certificateFuncs
(
t
),
)
)
...
...
staging/src/k8s.io/apimachinery/pkg/api/testing/fuzzer.go
View file @
2d5fe9d8
...
@@ -24,11 +24,11 @@ import (
...
@@ -24,11 +24,11 @@ import (
"github.com/google/gofuzz"
"github.com/google/gofuzz"
"k8s.io/apimachinery/pkg/api/resource"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime"
runtimeserializer
"k8s.io/apimachinery/pkg/runtime/serializer"
runtimeserializer
"k8s.io/apimachinery/pkg/runtime/serializer"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/api/resource"
)
)
func
GenericFuzzerFuncs
(
t
TestingCommon
,
codecs
runtimeserializer
.
CodecFactory
)
[]
interface
{}
{
func
GenericFuzzerFuncs
(
t
TestingCommon
,
codecs
runtimeserializer
.
CodecFactory
)
[]
interface
{}
{
...
@@ -159,3 +159,16 @@ func MergeFuzzerFuncs(t TestingCommon, funcLists ...[]interface{}) []interface{}
...
@@ -159,3 +159,16 @@ func MergeFuzzerFuncs(t TestingCommon, funcLists ...[]interface{}) []interface{}
}
}
return
result
return
result
}
}
func
DefaultFuzzers
(
t
TestingCommon
,
codecFactory
runtimeserializer
.
CodecFactory
,
fuzzerFuncs
[]
interface
{})
*
fuzz
.
Fuzzer
{
seed
:=
rand
.
Int63
()
return
FuzzerFor
(
MergeFuzzerFuncs
(
t
,
GenericFuzzerFuncs
(
t
,
codecFactory
),
fuzzerFuncs
,
),
rand
.
NewSource
(
seed
),
)
}
staging/src/k8s.io/apimachinery/pkg/api/testing/roundtrip.go
View file @
2d5fe9d8
...
@@ -31,6 +31,8 @@ import (
...
@@ -31,6 +31,8 @@ import (
apiequality
"k8s.io/apimachinery/pkg/api/equality"
apiequality
"k8s.io/apimachinery/pkg/api/equality"
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/apimachinery/announced"
"k8s.io/apimachinery/pkg/apimachinery/registered"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/runtime/schema"
runtimeserializer
"k8s.io/apimachinery/pkg/runtime/serializer"
runtimeserializer
"k8s.io/apimachinery/pkg/runtime/serializer"
...
@@ -38,6 +40,44 @@ import (
...
@@ -38,6 +40,44 @@ import (
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/sets"
)
)
type
InstallFunc
func
(
groupFactoryRegistry
announced
.
APIGroupFactoryRegistry
,
registry
*
registered
.
APIRegistrationManager
,
scheme
*
runtime
.
Scheme
)
// RoundTripTestForAPIGroup is convenient to call from your install package to make sure that a "bare" install of your group provides
// enough information to round trip
func
RoundTripTestForAPIGroup
(
t
*
testing
.
T
,
installFn
InstallFunc
,
fuzzingFuncs
[]
interface
{})
{
groupFactoryRegistry
:=
make
(
announced
.
APIGroupFactoryRegistry
)
registry
:=
registered
.
NewOrDie
(
""
)
scheme
:=
runtime
.
NewScheme
()
installFn
(
groupFactoryRegistry
,
registry
,
scheme
)
RoundTripTestForScheme
(
t
,
scheme
,
fuzzingFuncs
)
}
// RoundTripTestForScheme is convenient to call if you already have a scheme and want to make sure that its well-formed
func
RoundTripTestForScheme
(
t
*
testing
.
T
,
scheme
*
runtime
.
Scheme
,
fuzzingFuncs
[]
interface
{})
{
codecFactory
:=
runtimeserializer
.
NewCodecFactory
(
scheme
)
fuzzer
:=
DefaultFuzzers
(
t
,
codecFactory
,
fuzzingFuncs
)
RoundTripTypesWithoutProtobuf
(
t
,
scheme
,
codecFactory
,
fuzzer
,
nil
)
}
// RoundTripProtobufTestForAPIGroup is convenient to call from your install package to make sure that a "bare" install of your group provides
// enough information to round trip
func
RoundTripProtobufTestForAPIGroup
(
t
*
testing
.
T
,
installFn
InstallFunc
,
fuzzingFuncs
[]
interface
{})
{
groupFactoryRegistry
:=
make
(
announced
.
APIGroupFactoryRegistry
)
registry
:=
registered
.
NewOrDie
(
""
)
scheme
:=
runtime
.
NewScheme
()
installFn
(
groupFactoryRegistry
,
registry
,
scheme
)
RoundTripProtobufTestForScheme
(
t
,
scheme
,
fuzzingFuncs
)
}
// RoundTripProtobufTestForScheme is convenient to call if you already have a scheme and want to make sure that its well-formed
func
RoundTripProtobufTestForScheme
(
t
*
testing
.
T
,
scheme
*
runtime
.
Scheme
,
fuzzingFuncs
[]
interface
{})
{
codecFactory
:=
runtimeserializer
.
NewCodecFactory
(
scheme
)
fuzzer
:=
DefaultFuzzers
(
t
,
codecFactory
,
fuzzingFuncs
)
RoundTripTypes
(
t
,
scheme
,
codecFactory
,
fuzzer
,
nil
)
}
var
FuzzIters
=
flag
.
Int
(
"fuzz-iters"
,
20
,
"How many fuzzing iterations to do."
)
var
FuzzIters
=
flag
.
Int
(
"fuzz-iters"
,
20
,
"How many fuzzing iterations to do."
)
// globalNonRoundTrippableTypes are kinds that are effectively reserved across all GroupVersions
// globalNonRoundTrippableTypes are kinds that are effectively reserved across all GroupVersions
...
...
cmd/kubeadm/app/apis/kubeadm/v1alpha1/conversion
.go
→
staging/src/k8s.io/sample-apiserver/pkg/apis/wardle/install/install_test
.go
View file @
2d5fe9d8
/*
/*
Copyright 201
6
The Kubernetes Authors.
Copyright 201
7
The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
you may not use this file except in compliance with the License.
...
@@ -14,16 +14,14 @@ See the License for the specific language governing permissions and
...
@@ -14,16 +14,14 @@ See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
*/
*/
package
v1alpha1
package
install
import
(
import
(
"k8s.io/apimachinery/pkg/runtime"
"testing"
"k8s.io/client-go/pkg/api"
apitesting
"k8s.io/apimachinery/pkg/api/testing"
)
)
func
addConversionFuncs
(
scheme
*
runtime
.
Scheme
)
error
{
func
TestRoundTripTypes
(
t
*
testing
.
T
)
{
// Add non-generated conversion functions
apitesting
.
RoundTripTestForAPIGroup
(
t
,
Install
,
nil
)
return
scheme
.
AddConversionFuncs
(
api
.
Convert_v1_TypeMeta_To_v1_TypeMeta
,
)
}
}
cmd/kubeadm/app/apis/kubeadm/serialization
_test.go
→
staging/src/k8s.io/sample-apiserver/pkg/apiserver/scheme
_test.go
View file @
2d5fe9d8
/*
/*
Copyright 201
6
The Kubernetes Authors.
Copyright 201
7
The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
you may not use this file except in compliance with the License.
...
@@ -14,34 +14,14 @@ See the License for the specific language governing permissions and
...
@@ -14,34 +14,14 @@ See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
*/
*/
package
kubeadm_test
package
apiserver
import
(
import
(
"math/rand"
"testing"
"testing"
apitesting
"k8s.io/apimachinery/pkg/api/testing"
apitesting
"k8s.io/apimachinery/pkg/api/testing"
"k8s.io/apimachinery/pkg/apimachinery/announced"
"k8s.io/apimachinery/pkg/apimachinery/registered"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/serializer"
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/install"
kapitesting
"k8s.io/kubernetes/pkg/api/testing"
)
const
(
seed
=
1
)
)
func
TestRoundTripTypes
(
t
*
testing
.
T
)
{
func
TestRoundTripTypes
(
t
*
testing
.
T
)
{
groupFactoryRegistry
:=
make
(
announced
.
APIGroupFactoryRegistry
)
apitesting
.
RoundTripTestForScheme
(
t
,
Scheme
,
nil
)
registry
:=
registered
.
NewOrDie
(
""
)
scheme
:=
runtime
.
NewScheme
()
codecs
:=
serializer
.
NewCodecFactory
(
scheme
)
install
.
Install
(
groupFactoryRegistry
,
registry
,
scheme
)
// TODO: once we've pulled kubeadm types of the main scheme, we should
// move the fuzzers funcs here
fuzzer
:=
apitesting
.
FuzzerFor
(
kapitesting
.
FuzzerFuncs
(
t
,
codecs
),
rand
.
NewSource
(
seed
))
apitesting
.
RoundTripTypesWithoutProtobuf
(
t
,
scheme
,
codecs
,
fuzzer
,
nil
)
}
}
vendor/BUILD
View file @
2d5fe9d8
...
@@ -13861,6 +13861,8 @@ go_library(
...
@@ -13861,6 +13861,8 @@ go_library(
"//vendor:k8s.io/apimachinery/pkg/api/equality",
"//vendor:k8s.io/apimachinery/pkg/api/equality",
"//vendor:k8s.io/apimachinery/pkg/api/meta",
"//vendor:k8s.io/apimachinery/pkg/api/meta",
"//vendor:k8s.io/apimachinery/pkg/api/resource",
"//vendor:k8s.io/apimachinery/pkg/api/resource",
"//vendor:k8s.io/apimachinery/pkg/apimachinery/announced",
"//vendor:k8s.io/apimachinery/pkg/apimachinery/registered",
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
"//vendor:k8s.io/apimachinery/pkg/runtime",
"//vendor:k8s.io/apimachinery/pkg/runtime",
"//vendor:k8s.io/apimachinery/pkg/runtime/schema",
"//vendor:k8s.io/apimachinery/pkg/runtime/schema",
...
@@ -16878,3 +16880,19 @@ go_library(
...
@@ -16878,3 +16880,19 @@ go_library(
"//vendor:k8s.io/apiserver/pkg/storage/storagebackend",
"//vendor:k8s.io/apiserver/pkg/storage/storagebackend",
],
],
)
)
go_test(
name = "k8s.io/sample-apiserver/pkg/apis/wardle/install_test",
srcs = ["k8s.io/sample-apiserver/pkg/apis/wardle/install/install_test.go"],
library = ":k8s.io/sample-apiserver/pkg/apis/wardle/install",
tags = ["automanaged"],
deps = ["//vendor:k8s.io/apimachinery/pkg/api/testing"],
)
go_test(
name = "k8s.io/sample-apiserver/pkg/apiserver_test",
srcs = ["k8s.io/sample-apiserver/pkg/apiserver/scheme_test.go"],
library = ":k8s.io/sample-apiserver/pkg/apiserver",
tags = ["automanaged"],
deps = ["//vendor:k8s.io/apimachinery/pkg/api/testing"],
)
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