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
3b978b3c
Commit
3b978b3c
authored
Oct 09, 2018
by
stewart-yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add kube-controller manager round trip test
parent
323e1375
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
0 deletions
+76
-0
fuzzer.go
pkg/controller/apis/config/fuzzer/fuzzer.go
+48
-0
scheme_test.go
pkg/controller/apis/config/scheme/scheme_test.go
+28
-0
No files found.
pkg/controller/apis/config/fuzzer/fuzzer.go
0 → 100644
View file @
3b978b3c
/*
Copyright 2018 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
fuzzer
import
(
"fmt"
"github.com/google/gofuzz"
runtimeserializer
"k8s.io/apimachinery/pkg/runtime/serializer"
kubectrlmgrconfig
"k8s.io/kubernetes/pkg/controller/apis/config"
)
// Funcs returns the fuzzer functions for the kube-controller manager apis.
func
Funcs
(
codecs
runtimeserializer
.
CodecFactory
)
[]
interface
{}
{
return
[]
interface
{}{
func
(
obj
*
kubectrlmgrconfig
.
KubeControllerManagerConfiguration
,
c
fuzz
.
Continue
)
{
c
.
FuzzNoCustom
(
obj
)
obj
.
Generic
.
Address
=
fmt
.
Sprintf
(
"%d.%d.%d.%d"
,
c
.
Intn
(
256
),
c
.
Intn
(
256
),
c
.
Intn
(
256
),
c
.
Intn
(
256
))
obj
.
Generic
.
ClientConnection
.
ContentType
=
fmt
.
Sprintf
(
"%s/%s.%s.%s"
,
c
.
RandString
(),
c
.
RandString
(),
c
.
RandString
(),
c
.
RandString
())
if
obj
.
Generic
.
LeaderElection
.
ResourceLock
==
""
{
obj
.
Generic
.
LeaderElection
.
ResourceLock
=
"endpoints"
}
obj
.
Generic
.
Controllers
=
[]
string
{
fmt
.
Sprintf
(
"%s"
,
c
.
RandString
())}
if
obj
.
KubeCloudShared
.
ClusterName
==
""
{
obj
.
KubeCloudShared
.
ClusterName
=
"kubernetes"
}
obj
.
CSRSigningController
.
ClusterSigningCertFile
=
fmt
.
Sprintf
(
"/%s"
,
c
.
RandString
())
obj
.
CSRSigningController
.
ClusterSigningKeyFile
=
fmt
.
Sprintf
(
"/%s"
,
c
.
RandString
())
obj
.
PersistentVolumeBinderController
.
VolumeConfiguration
.
FlexVolumePluginDir
=
fmt
.
Sprintf
(
"/%s"
,
c
.
RandString
())
obj
.
TTLAfterFinishedController
.
ConcurrentTTLSyncs
=
c
.
Int31
()
},
}
}
pkg/controller/apis/config/scheme/scheme_test.go
0 → 100644
View file @
3b978b3c
/*
Copyright 2018 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
scheme
import
(
"testing"
"k8s.io/apimachinery/pkg/api/apitesting/roundtrip"
"k8s.io/kubernetes/pkg/controller/apis/config/fuzzer"
)
func
TestRoundTripTypes
(
t
*
testing
.
T
)
{
roundtrip
.
RoundTripTestForScheme
(
t
,
Scheme
,
fuzzer
.
Funcs
)
}
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