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
14d01883
Commit
14d01883
authored
Nov 18, 2017
by
xiangpengzhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add kubeproxyconfig round trip test
parent
f5f6f3e7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
0 deletions
+76
-0
fuzzer.go
pkg/proxy/apis/kubeproxyconfig/fuzzer/fuzzer.go
+48
-0
scheme_test.go
pkg/proxy/apis/kubeproxyconfig/scheme/scheme_test.go
+28
-0
No files found.
pkg/proxy/apis/kubeproxyconfig/fuzzer/fuzzer.go
0 → 100644
View file @
14d01883
/*
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"
"time"
"github.com/google/gofuzz"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
runtimeserializer
"k8s.io/apimachinery/pkg/runtime/serializer"
"k8s.io/kubernetes/pkg/proxy/apis/kubeproxyconfig"
utilpointer
"k8s.io/kubernetes/pkg/util/pointer"
)
// Funcs returns the fuzzer functions for the kube-proxy apis.
func
Funcs
(
codecs
runtimeserializer
.
CodecFactory
)
[]
interface
{}
{
return
[]
interface
{}{
func
(
obj
*
kubeproxyconfig
.
KubeProxyConfiguration
,
c
fuzz
.
Continue
)
{
c
.
FuzzNoCustom
(
obj
)
obj
.
BindAddress
=
fmt
.
Sprintf
(
"%d.%d.%d.%d"
,
c
.
Intn
(
256
),
c
.
Intn
(
256
),
c
.
Intn
(
256
),
c
.
Intn
(
256
))
obj
.
Conntrack
.
MaxPerCore
=
utilpointer
.
Int32Ptr
(
c
.
Int31
())
obj
.
Conntrack
.
Min
=
utilpointer
.
Int32Ptr
(
c
.
Int31
())
obj
.
Conntrack
.
TCPCloseWaitTimeout
=
&
metav1
.
Duration
{
Duration
:
time
.
Duration
(
c
.
Int63
())
*
time
.
Hour
}
obj
.
Conntrack
.
TCPEstablishedTimeout
=
&
metav1
.
Duration
{
Duration
:
time
.
Duration
(
c
.
Int63
())
*
time
.
Hour
}
obj
.
HealthzBindAddress
=
fmt
.
Sprintf
(
"%d.%d.%d.%d:%d"
,
c
.
Intn
(
256
),
c
.
Intn
(
256
),
c
.
Intn
(
256
),
c
.
Intn
(
256
),
c
.
Intn
(
65536
))
obj
.
IPTables
.
MasqueradeBit
=
utilpointer
.
Int32Ptr
(
c
.
Int31
())
obj
.
MetricsBindAddress
=
fmt
.
Sprintf
(
"%d.%d.%d.%d:%d"
,
c
.
Intn
(
256
),
c
.
Intn
(
256
),
c
.
Intn
(
256
),
c
.
Intn
(
256
),
c
.
Intn
(
65536
))
obj
.
OOMScoreAdj
=
utilpointer
.
Int32Ptr
(
c
.
Int31
())
obj
.
ResourceContainer
=
c
.
RandString
()
},
}
}
pkg/proxy/apis/kubeproxyconfig/scheme/scheme_test.go
0 → 100644
View file @
14d01883
/*
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/testing/roundtrip"
"k8s.io/kubernetes/pkg/proxy/apis/kubeproxyconfig/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